-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support accent setting for selectors (#1925)
Co-authored-by: datalens-weblate-robot <[email protected]> Co-authored-by: Darya Tikhonova <[email protected]> Co-authored-by: Matthew Casserly <[email protected]>
- Loading branch information
1 parent
e5c259a
commit 2d5e359
Showing
20 changed files
with
217 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 3 additions & 7 deletions
10
src/ui/components/ControlComponents/Sections/AppearanceSection/AppearanceSection.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
.control2-appearance-section { | ||
&__operation-container { | ||
&__setting-container { | ||
display: flex; | ||
align-items: center; | ||
min-height: var(--gc-form-row-field-height); | ||
} | ||
|
||
&__operation-checkbox { | ||
&__setting-checkbox { | ||
margin-right: 8px; | ||
|
||
&_top { | ||
align-self: flex-start; | ||
margin-top: 4px; | ||
} | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
...nents/ControlComponents/Sections/AppearanceSection/Rows/ColorAccentRow/ColorAccentRow.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import React from 'react'; | ||
|
||
import {FormRow, HelpPopover} from '@gravity-ui/components'; | ||
import {Checkbox} from '@gravity-ui/uikit'; | ||
import block from 'bem-cn-lite'; | ||
import {I18n} from 'i18n'; | ||
import {useDispatch, useSelector} from 'react-redux'; | ||
import {setSelectorDialogItem} from 'ui/store/actions/controlDialog'; | ||
import { | ||
selectIsControlConfigurationDisabled, | ||
selectSelectorDialog, | ||
} from 'ui/store/selectors/controlDialog'; | ||
|
||
import '../../AppearanceSection.scss'; | ||
|
||
const b = block('control2-appearance-section'); | ||
|
||
const i18n = I18n.keyset('dash.control-dialog.edit'); | ||
|
||
export const ColorAccentRow = () => { | ||
const dispatch = useDispatch(); | ||
const {accentType} = useSelector(selectSelectorDialog); | ||
const isFieldDisabled = useSelector(selectIsControlConfigurationDisabled); | ||
|
||
const handleaccentTypeUpdate = React.useCallback( | ||
(enableAccent) => { | ||
const updatedType = enableAccent ? 'info' : null; | ||
|
||
dispatch( | ||
setSelectorDialogItem({ | ||
accentType: updatedType, | ||
}), | ||
); | ||
}, | ||
[dispatch], | ||
); | ||
|
||
const label = ( | ||
<React.Fragment> | ||
<span>{i18n('field_color-accent')}</span> | ||
<HelpPopover | ||
placement={['bottom', 'top']} | ||
offset={{top: -1, left: 5}} | ||
content={i18n('field_color-accent-note')} | ||
/> | ||
</React.Fragment> | ||
); | ||
|
||
return ( | ||
<FormRow label={label}> | ||
<div className={b('setting-container')}> | ||
<Checkbox | ||
disabled={isFieldDisabled} | ||
onUpdate={handleaccentTypeUpdate} | ||
checked={Boolean(accentType)} | ||
size="l" | ||
className={b('setting-checkbox')} | ||
/> | ||
</div> | ||
</FormRow> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.