mirror of
https://gitlab.com/bramw/baserow.git
synced 2025-04-17 10:22:36 +00:00
Redesign checkbox & switch restyling
This commit is contained in:
parent
60ccad226d
commit
c50b83587c
11 changed files with 156 additions and 124 deletions
changelog/entries/1.21.0/feature
premium/web-frontend/modules/baserow_premium/components/views
web-frontend
modules
core
database/components
test/unit/database/components
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"type": "feature",
|
||||||
|
"message": "Restyle switch and checkbox components",
|
||||||
|
"issue_number": 1918,
|
||||||
|
"bullet_points": [],
|
||||||
|
"created_at": "2023-10-10"
|
||||||
|
}
|
|
@ -6,18 +6,17 @@
|
||||||
@click="click"
|
@click="click"
|
||||||
>
|
>
|
||||||
<SwitchInput
|
<SwitchInput
|
||||||
large
|
|
||||||
:value="!view.show_logo"
|
:value="!view.show_logo"
|
||||||
:disabled="!hasPremiumFeatures"
|
:disabled="!hasPremiumFeatures"
|
||||||
@input="update"
|
@input="update"
|
||||||
|
>
|
||||||
|
<img src="@baserow/modules/core/static/img/baserow-icon.svg" />
|
||||||
|
<span>
|
||||||
|
{{ $t('shareLinkOptions.baserowLogo.label') }}
|
||||||
|
</span>
|
||||||
|
<i v-if="!hasPremiumFeatures" class="deactivated-label iconoir-lock"></i
|
||||||
></SwitchInput>
|
></SwitchInput>
|
||||||
|
|
||||||
<img src="@baserow/modules/core/static/img/baserow-icon.svg" />
|
|
||||||
<span>
|
|
||||||
{{ $t('shareLinkOptions.baserowLogo.label') }}
|
|
||||||
</span>
|
|
||||||
<i v-if="!hasPremiumFeatures" class="deactivated-label iconoir-lock"></i>
|
|
||||||
|
|
||||||
<PremiumModal
|
<PremiumModal
|
||||||
v-if="!hasPremiumFeatures"
|
v-if="!hasPremiumFeatures"
|
||||||
ref="premiumModal"
|
ref="premiumModal"
|
||||||
|
|
|
@ -194,23 +194,15 @@
|
||||||
.checkbox {
|
.checkbox {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 28px;
|
height: 28px;
|
||||||
line-height: 28px;
|
|
||||||
padding-left: 18px;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
@include flex-align-items(4px);
|
||||||
&.checkbox--has-content {
|
|
||||||
padding-left: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
@include absolute(5px, auto, 0, 0);
|
|
||||||
|
|
||||||
content: '';
|
content: '';
|
||||||
border: 1px solid $color-neutral-400;
|
border: 1px solid $color-neutral-400;
|
||||||
width: 18px;
|
width: 20px;
|
||||||
height: 18px;
|
height: 20px;
|
||||||
line-height: 18px;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background-color: $white;
|
background-color: $white;
|
||||||
color: $color-success-600;
|
color: $color-success-600;
|
||||||
|
@ -226,14 +218,14 @@
|
||||||
color: $color-neutral-500;
|
color: $color-neutral-500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.checkbox--small::before {
|
.checkbox__label {
|
||||||
@include absolute(6px, auto, 0, 0);
|
color: $palette-neutral-900;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
width: 16px;
|
.checkbox.active & {
|
||||||
height: 16px;
|
color: $palette-neutral-1200;
|
||||||
line-height: 16px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +235,7 @@
|
||||||
left: 2px;
|
left: 2px;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
color: $color-success-600;
|
color: $color-success-600;
|
||||||
font-size: 14px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.radio {
|
.radio {
|
||||||
|
@ -324,109 +316,127 @@
|
||||||
|
|
||||||
.switch {
|
.switch {
|
||||||
position: relative;
|
position: relative;
|
||||||
line-height: 28px;
|
|
||||||
height: 28px;
|
|
||||||
padding-left: 22px;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
height: 28px;
|
||||||
@include flex-align-items(4px);
|
line-height: 28px;
|
||||||
|
@include flex-align-items(10px);
|
||||||
|
|
||||||
&.switch--static {
|
&.switch--static {
|
||||||
cursor: initial;
|
cursor: initial;
|
||||||
user-select: initial;
|
user-select: initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.switch--has-content {
|
|
||||||
padding-left: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
content: '';
|
content: '';
|
||||||
width: 22px;
|
|
||||||
height: 12px;
|
|
||||||
background-color: $color-neutral-200;
|
|
||||||
|
|
||||||
@include rounded($rounded-xl);
|
@include rounded($rounded-xl);
|
||||||
@include absolute(9px, auto, auto, 0);
|
|
||||||
|
width: 24px;
|
||||||
|
height: 16px;
|
||||||
|
background-color: $color-neutral-600;
|
||||||
}
|
}
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
content: '';
|
content: '';
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
width: 6px;
|
width: 12px;
|
||||||
height: 6px;
|
height: 12px;
|
||||||
background-color: $white;
|
background-color: $white;
|
||||||
transition: left 0.085s ease-in;
|
transition: left 0.1s ease-in;
|
||||||
|
box-shadow: 0 1px 3px 0 rgba(7, 13, 16, 0.15),
|
||||||
|
0 0 1px 0 rgba(7, 13, 16, 0.15);
|
||||||
|
|
||||||
@include absolute(12px, auto, auto, 4px);
|
@include absolute(8px, auto, auto, 2px);
|
||||||
}
|
|
||||||
|
|
||||||
&.active {
|
|
||||||
&::before {
|
|
||||||
background-color: $color-success-500;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
left: 12px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&.unknown {
|
&.unknown {
|
||||||
&::before {
|
&::before {
|
||||||
background-color: $color-warning-500;
|
background-color: $palette-yellow-500;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
&::before {
|
||||||
|
background-color: $palette-yellow-800;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
left: 8px;
|
left: 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
&::before {
|
||||||
|
background-color: $color-neutral-500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
&::before {
|
||||||
|
background-color: $palette-green-500;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
&::before {
|
||||||
|
background-color: $palette-green-800;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
left: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.switch--disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
background-color: $palette-neutral-400;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.switch--large {
|
&.switch--large {
|
||||||
padding-left: 28px;
|
|
||||||
|
|
||||||
&.switch--has-content {
|
|
||||||
padding-left: 36px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
top: 6px;
|
height: 24px;
|
||||||
height: 16px;
|
width: 40px;
|
||||||
width: 28px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
top: 10px;
|
top: 4px;
|
||||||
width: 7px;
|
width: 20px;
|
||||||
height: 7px;
|
height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.unknown {
|
||||||
|
&::after {
|
||||||
|
left: 8px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.active::after {
|
&.active::after {
|
||||||
left: 17px;
|
left: 17px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.unknown::after {
|
|
||||||
left: 10.5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.switch--disabled {
|
|
||||||
cursor: inherit;
|
|
||||||
|
|
||||||
&.active::before {
|
|
||||||
background-color: $color-neutral-600;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.unknown::before {
|
|
||||||
background-color: $color-neutral-400;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.switch__icon {
|
.switch__label {
|
||||||
margin-right: 4px;
|
display: flex;
|
||||||
color: $color-neutral-600;
|
align-items: center;
|
||||||
font-size: 16px;
|
gap: 5px;
|
||||||
|
color: $palette-neutral-900;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
.switch--disabled & {
|
||||||
|
color: $palette-neutral-700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch.active & {
|
||||||
|
color: $palette-neutral-1200;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="checkbox" :class="classNames" @click="toggle(value)">
|
<div class="checkbox" :class="classNames" @click="toggle(value)">
|
||||||
<i v-if="value === true" class="checkbox__checked-icon iconoir-check"></i>
|
<i v-if="value === true" class="checkbox__checked-icon iconoir-check"></i>
|
||||||
<slot></slot>
|
<label class="checkbox__label"><slot></slot></label>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="switch" :class="classNames" @click="toggle(value)">
|
<div class="switch" :class="classNames" @click="toggle(value)">
|
||||||
<slot></slot>
|
<label v-if="hasSlot" class="switch__label"> <slot></slot></label>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -37,6 +37,9 @@ export default {
|
||||||
unknown: this.value !== true && this.value !== false,
|
unknown: this.value !== true && this.value !== false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
hasSlot() {
|
||||||
|
return !!this.$slots.default
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toggle(value) {
|
toggle(value) {
|
||||||
|
|
|
@ -229,16 +229,19 @@
|
||||||
<div class="control__elements">
|
<div class="control__elements">
|
||||||
value: {{ switchValue }}
|
value: {{ switchValue }}
|
||||||
<br />
|
<br />
|
||||||
<br />
|
|
||||||
<SwitchInput v-model="switchValue"></SwitchInput>
|
<SwitchInput v-model="switchValue"></SwitchInput>
|
||||||
<SwitchInput v-model="switchValue">With text</SwitchInput>
|
<SwitchInput v-model="switchValue">With text</SwitchInput>
|
||||||
<SwitchInput v-model="switchUnknown">With text</SwitchInput>
|
<SwitchInput v-model="switchUnknown">With text</SwitchInput>
|
||||||
<SwitchInput v-model="switchValue" :large="true"></SwitchInput>
|
<SwitchInput v-model="switchUnknown" large>With text</SwitchInput>
|
||||||
<SwitchInput v-model="switchValue" :large="true">
|
<SwitchInput v-model="switchValue" large></SwitchInput>
|
||||||
With text
|
<SwitchInput v-model="switchValue" large>
|
||||||
|
Large with text
|
||||||
</SwitchInput>
|
</SwitchInput>
|
||||||
<SwitchInput v-model="switchUnknown" :large="true">
|
<SwitchInput v-model="switchUnknown" disabled>
|
||||||
With text
|
Disabled
|
||||||
|
</SwitchInput>
|
||||||
|
<SwitchInput v-model="switchUnknown" disabled large>
|
||||||
|
Large disabled
|
||||||
</SwitchInput>
|
</SwitchInput>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1623,10 +1626,7 @@
|
||||||
class="data-table__table-cell data-table__table-cell--sticky-left data-table__table-cell--header"
|
class="data-table__table-cell data-table__table-cell--sticky-left data-table__table-cell--header"
|
||||||
>
|
>
|
||||||
<div class="data-table__table-cell-head">
|
<div class="data-table__table-cell-head">
|
||||||
<Checkbox
|
<Checkbox v-model="checkbox"></Checkbox>
|
||||||
v-model="checkbox"
|
|
||||||
class="checkbox--small"
|
|
||||||
></Checkbox>
|
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
<th
|
<th
|
||||||
|
@ -1684,10 +1684,7 @@
|
||||||
class="data-table__table-cell data-table__table-cell--sticky-left"
|
class="data-table__table-cell data-table__table-cell--sticky-left"
|
||||||
>
|
>
|
||||||
<div class="data-table__table-cell-content">
|
<div class="data-table__table-cell-content">
|
||||||
<Checkbox
|
<Checkbox v-model="checkbox"></Checkbox>
|
||||||
v-model="checkbox"
|
|
||||||
class="checkbox--small"
|
|
||||||
></Checkbox>
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="data-table__table-cell">
|
<td class="data-table__table-cell">
|
||||||
|
|
|
@ -117,10 +117,9 @@
|
||||||
:key="operation"
|
:key="operation"
|
||||||
class="api-token__permission"
|
class="api-token__permission"
|
||||||
>
|
>
|
||||||
{{ operationName }}
|
<span>{{ operationName }}</span>
|
||||||
<SwitchInput
|
<SwitchInput
|
||||||
:value="isActive(operation)"
|
:value="isActive(operation)"
|
||||||
:large="true"
|
|
||||||
@input="toggle(operation, $event)"
|
@input="toggle(operation, $event)"
|
||||||
></SwitchInput>
|
></SwitchInput>
|
||||||
</div>
|
</div>
|
||||||
|
@ -140,7 +139,6 @@
|
||||||
>
|
>
|
||||||
<SwitchInput
|
<SwitchInput
|
||||||
:value="isDatabaseActive(database, operation)"
|
:value="isDatabaseActive(database, operation)"
|
||||||
:large="true"
|
|
||||||
@input="toggleDatabase(database, databases, operation, $event)"
|
@input="toggleDatabase(database, databases, operation, $event)"
|
||||||
></SwitchInput>
|
></SwitchInput>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -63,21 +63,19 @@
|
||||||
<div class="view-sharing__option">
|
<div class="view-sharing__option">
|
||||||
<SwitchInput
|
<SwitchInput
|
||||||
:value="view.public_view_has_password"
|
:value="view.public_view_has_password"
|
||||||
:large="true"
|
|
||||||
@input="toggleShareViewPassword"
|
@input="toggleShareViewPassword"
|
||||||
>
|
>
|
||||||
|
<i
|
||||||
|
class="view-sharing__option-icon"
|
||||||
|
:class="[
|
||||||
|
view.public_view_has_password
|
||||||
|
? 'iconoir-lock'
|
||||||
|
: 'iconoir-globe',
|
||||||
|
]"
|
||||||
|
></i>
|
||||||
|
<span>{{ $t(optionPasswordText) }}</span>
|
||||||
</SwitchInput>
|
</SwitchInput>
|
||||||
|
|
||||||
<i
|
|
||||||
class="view-sharing__option-icon"
|
|
||||||
:class="[
|
|
||||||
view.public_view_has_password
|
|
||||||
? 'iconoir-lock'
|
|
||||||
: 'iconoir-globe',
|
|
||||||
]"
|
|
||||||
></i>
|
|
||||||
<span>{{ $t(optionPasswordText) }}</span>
|
|
||||||
|
|
||||||
<a
|
<a
|
||||||
v-if="view.public_view_has_password"
|
v-if="view.public_view_has_password"
|
||||||
class="view-sharing__option-change-password"
|
class="view-sharing__option-change-password"
|
||||||
|
|
|
@ -101,7 +101,6 @@
|
||||||
</div>
|
</div>
|
||||||
<SwitchInput
|
<SwitchInput
|
||||||
:value="fieldOptions.required"
|
:value="fieldOptions.required"
|
||||||
:large="true"
|
|
||||||
:disabled="readOnly"
|
:disabled="readOnly"
|
||||||
@input="$emit('updated-field-options', { required: $event })"
|
@input="$emit('updated-field-options', { required: $event })"
|
||||||
>{{ $t('formViewField.required') }}</SwitchInput
|
>{{ $t('formViewField.required') }}</SwitchInput
|
||||||
|
@ -109,7 +108,6 @@
|
||||||
<SwitchInput
|
<SwitchInput
|
||||||
v-if="allowedConditionalFields.length > 0"
|
v-if="allowedConditionalFields.length > 0"
|
||||||
:value="fieldOptions.show_when_matching_conditions"
|
:value="fieldOptions.show_when_matching_conditions"
|
||||||
:large="true"
|
|
||||||
:disabled="readOnly"
|
:disabled="readOnly"
|
||||||
@input="setShowWhenMatchingConditions($event)"
|
@input="setShowWhenMatchingConditions($event)"
|
||||||
>{{ $t('formViewField.showWhenMatchingConditions') }}</SwitchInput
|
>{{ $t('formViewField.showWhenMatchingConditions') }}</SwitchInput
|
||||||
|
|
|
@ -1495,7 +1495,12 @@ exports[`Preview exportTableModal Modal with no view 1`] = `
|
||||||
<i
|
<i
|
||||||
class="checkbox__checked-icon iconoir-check"
|
class="checkbox__checked-icon iconoir-check"
|
||||||
/>
|
/>
|
||||||
common.yes
|
|
||||||
|
<label
|
||||||
|
class="checkbox__label"
|
||||||
|
>
|
||||||
|
common.yes
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -3026,7 +3031,12 @@ exports[`Preview exportTableModal Modal with view 1`] = `
|
||||||
<i
|
<i
|
||||||
class="checkbox__checked-icon iconoir-check"
|
class="checkbox__checked-icon iconoir-check"
|
||||||
/>
|
/>
|
||||||
common.yes
|
|
||||||
|
<label
|
||||||
|
class="checkbox__label"
|
||||||
|
>
|
||||||
|
common.yes
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1048,7 +1048,11 @@ exports[`ViewFilterForm component Full view filter component 1`] = `
|
||||||
<div
|
<div
|
||||||
class="switch switch--has-content"
|
class="switch switch--has-content"
|
||||||
>
|
>
|
||||||
viewFilterContext.disableAllFilters
|
<label
|
||||||
|
class="switch__label"
|
||||||
|
>
|
||||||
|
viewFilterContext.disableAllFilters
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1466,7 +1470,11 @@ exports[`ViewFilterForm component Test rating filter 1`] = `
|
||||||
<div
|
<div
|
||||||
class="switch switch--has-content"
|
class="switch switch--has-content"
|
||||||
>
|
>
|
||||||
viewFilterContext.disableAllFilters
|
<label
|
||||||
|
class="switch__label"
|
||||||
|
>
|
||||||
|
viewFilterContext.disableAllFilters
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1884,7 +1892,11 @@ exports[`ViewFilterForm component Test rating filter 2`] = `
|
||||||
<div
|
<div
|
||||||
class="switch switch--has-content"
|
class="switch switch--has-content"
|
||||||
>
|
>
|
||||||
viewFilterContext.disableAllFilters
|
<label
|
||||||
|
class="switch__label"
|
||||||
|
>
|
||||||
|
viewFilterContext.disableAllFilters
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue