From 54ac0d36499e572844e42cfff8f7781387731b00 Mon Sep 17 00:00:00 2001 From: Yuriy Demidov Date: Tue, 10 Dec 2024 15:58:23 +0300 Subject: [PATCH] feat(bundle): update view of text color action item in toolbar (#514) --- .../toolbar/ToolbarButtonWithPopupMenu.tsx | 25 +++++++++++++++---- src/bundle/toolbar/custom/ToolbarColors.scss | 9 +++++++ src/bundle/toolbar/custom/ToolbarColors.tsx | 3 +++ 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/bundle/toolbar/ToolbarButtonWithPopupMenu.tsx b/src/bundle/toolbar/ToolbarButtonWithPopupMenu.tsx index f225d53e..03d0afdd 100644 --- a/src/bundle/toolbar/ToolbarButtonWithPopupMenu.tsx +++ b/src/bundle/toolbar/ToolbarButtonWithPopupMenu.tsx @@ -26,8 +26,12 @@ export type MenuItem = { export type ToolbarButtonWithPopupMenuProps = Omit< ToolbarBaseProps & { icon: ToolbarIconData; + iconClassName?: string; + chevronIconClassName?: string; title: string | (() => string); menuItems: MenuItem[]; + /** @default 'classic' */ + _selectionType?: 'classic' | 'light'; }, 'editor' >; @@ -37,8 +41,11 @@ export const ToolbarButtonWithPopupMenu: React.FC { const buttonRef = React.useRef(null); const [open, , hide, toggleOpen] = useBooleanState(false); @@ -48,7 +55,7 @@ export const ToolbarButtonWithPopupMenu: React.FC ({...i, group: i.group || ''})), 'group', ), - [menuItems, groupBy], + [menuItems], ); const someActive = menuItems.some( @@ -64,6 +71,14 @@ export const ToolbarButtonWithPopupMenu: React.FC - + {''} - + diff --git a/src/bundle/toolbar/custom/ToolbarColors.scss b/src/bundle/toolbar/custom/ToolbarColors.scss index 1b573159..e5e8bcd4 100644 --- a/src/bundle/toolbar/custom/ToolbarColors.scss +++ b/src/bundle/toolbar/custom/ToolbarColors.scss @@ -2,10 +2,19 @@ $colors: ('gray', 'yellow', 'orange', 'red', 'green', 'blue', 'violet'); .g-md-toolbar-colors { @each $name in $colors { + &__menu-icon_color_#{$name} { + color: var(--yfm-colorify-#{$name}); + } + + &__chevron-icon_color_#{$name} { + color: var(--yfm-colorify-#{$name}); + } + &__item-icon_color_#{$name} { color: var(--yfm-colorify-#{$name}); } } + &__item-icon_color_default { color: var(--g-color-text-primary); } diff --git a/src/bundle/toolbar/custom/ToolbarColors.tsx b/src/bundle/toolbar/custom/ToolbarColors.tsx index 68b087a5..1633e6c9 100644 --- a/src/bundle/toolbar/custom/ToolbarColors.tsx +++ b/src/bundle/toolbar/custom/ToolbarColors.tsx @@ -77,6 +77,9 @@ export const ToolbarColors: React.FC = (props) => { title={i18n('colorify')} menuItems={items} icon={textColorIcon} + _selectionType="light" + iconClassName={b('menu-icon', {color: currentColor})} + chevronIconClassName={b('chevron-icon', {color: currentColor})} /> ); };