@frontify/sidebar-settings
v0.10.0
Published
Provides types and helpers for the settings sidebar
Downloads
6,007
Readme
Sidebar Settings
Provides the settings types for the guideline-blocks.
Example
/* (c) Copyright Frontify Ltd., all rights reserved. */
import { BlockSettings, Bundle } from '@frontify/guideline-blocks-settings';
import { IconEnum } from '@frontify/fondue';
export const settings: BlockSettings = {
main: [
{
id: 'example',
type: 'dropdown',
size: 'Large',
defaultValue: 'solid',
choices: [
{
value: 'noline',
icon: IconEnum.LineSpacer,
label: 'Spacer (no line)',
},
{
value: 'solid',
icon: IconEnum.LineSolid,
label: 'Line',
},
],
onChange: (bundle: Bundle): void => {
const blockWidth = Number(bundle.getBlock('widthCustom')?.value);
if (!Number.isNaN(blockWidth)) {
bundle.setBlockValue('widthCustom', `${blockWidth}%`);
}
},
},
],
};