@frontify/sidebar-settings
TypeScript icon, indicating that this package has built-in type declarations

0.10.0 • Public • Published

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}%`);
                }
            },
        },
    ],
};

Readme

Keywords

none

Package Sidebar

Install

npm i @frontify/sidebar-settings

Weekly Downloads

1,359

Version

0.10.0

License

none

Unpacked Size

230 kB

Total Files

63

Last publish

Collaborators

  • frontify-dev
  • samuel.alev