Skip to content

Commit

Permalink
Merge pull request #3558 from bettyblocks/feat/add-options-for-icon-p…
Browse files Browse the repository at this point in the history
…osition-color-expansion-panel-PFR-952

feat: add icon, icon position and icon color options to expansion panel PFR-952
  • Loading branch information
ingmar-stipriaan authored Dec 30, 2024
2 parents d5d1b3e + 8f4db94 commit bfccea1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/components/expansionPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
square,
variant,
elevation,
icon,
iconPosition,
dataComponentAttribute,
preLoadData,
} = options;
Expand Down Expand Up @@ -92,7 +94,10 @@

const panelSummaryOptions = {
onClick,
expandIcon: <Icon name="ExpandMore" />,
expandIcon: <Icon name={icon} />,
IconButtonProps: {
edge: iconPosition,
},
};

const ShowChilderen = <>{dataShown || isDev ? children : ''}</>;
Expand Down Expand Up @@ -227,6 +232,13 @@
marginLeft: ({ options: { outerSpacing } }) =>
getSpacing(outerSpacing[3], 'Desktop'),
},
'& .MuiExpansionPanelSummary-root': {
flexDirection: ({ options: { iconPosition } }) =>
iconPosition === 'start' && 'row-reverse',
},
'& .MuiExpansionPanelSummary-expandIcon': {
color: ({ options: { iconColor } }) => style.getColor(iconColor),
},
},
empty: {
display: 'flex',
Expand Down
17 changes: 17 additions & 0 deletions src/prefabs/structures/ExpansionPanel/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import {
option,
showIf,
sizes,
icon,
color,
ThemeColor,
} from '@betty-blocks/component-sdk';
import { styles } from './styles';
import { advanced } from '../../advanced';
Expand Down Expand Up @@ -73,6 +76,20 @@ export const expansionPanelOptions = {
condition: showIf('variant', 'EQ', 'elevation'),
},
}),
icon: icon('Icon', { value: 'ExpandMore' }),
iconPosition: option('CUSTOM', {
label: 'Icon position',
value: 'end',
configuration: {
as: 'BUTTONGROUP',
dataType: 'string',
allowedInput: [
{ name: 'Start', value: 'start' },
{ name: 'End', value: 'end' },
],
},
}),
iconColor: color('Icon color', { value: ThemeColor.DARK }),
...styles,

outerSpacing: sizes('Outer space', {
Expand Down

0 comments on commit bfccea1

Please sign in to comment.