| @@ -10,9 +10,11 @@ | ||
| 10 | 10 | attributes: Attributes; |
| 11 | 11 | onClick: (slug: string) => void; |
| 12 | 12 | }; |
| 13 | 13 | export const HeaderSelect = ({ attributes, onClick }: HeaderSelectProps) => { |
| 14 | - const { headerType, bgColor } = attributes; | |
| 14 | + const { headerType, ...attributesWithoutHeaderType }: Partial<Attributes> = | |
| 15 | + attributes; | |
| 16 | + const { bgColor } = attributes; | |
| 15 | 17 | const types = { |
| 16 | 18 | none: __('None', 'code-block-pro'), |
| 17 | 19 | headlights: __('Headlights', 'code-block-pro'), |
| 18 | 20 | headlightsMuted: __('Headlights muted', 'code-block-pro'), |
| @@ -19,13 +21,8 @@ | ||
| 19 | 21 | headlightsMutedAlt: __('Headlights muted alt', 'code-block-pro'), |
| 20 | 22 | simpleString: __('Simple string', 'code-block-pro'), |
| 21 | 23 | }; |
| 22 | 24 | |
| 23 | - const attributesWithoutHeaderType = { | |
| 24 | - ...attributes, | |
| 25 | - } as Partial<Attributes>; | |
| 26 | - delete attributesWithoutHeaderType.headerType; | |
| 27 | - | |
| 28 | 25 | return ( |
| 29 | 26 | <div className="code-block-pro-editor"> |
| 30 | 27 | {Object.entries(types).map(([slug, type]) => ( |
| 31 | 28 | <BaseControl |
| @@ -37,14 +34,23 @@ | ||
| 37 | 34 | type, |
| 38 | 35 | ) |
| 39 | 36 | : type |
| 40 | 37 | } |
| 38 | + help={ | |
| 39 | + ['simpleString'].includes(slug) | |
| 40 | + ? // Settings refers to the panel that can be expanded | |
| 41 | + __( | |
| 42 | + 'Update extras in the Settings panel', | |
| 43 | + 'code-block-pro', | |
| 44 | + ) | |
| 45 | + : undefined | |
| 46 | + } | |
| 41 | 47 | key={slug}> |
| 42 | 48 | <button |
| 43 | 49 | id={`code-block-pro-header-${slug}`} |
| 44 | 50 | type="button" |
| 45 | 51 | onClick={() => onClick(slug)} |
| 46 | - className="p-0 border flex items-start w-full text-left outline-none cursor-pointer no-underline ring-offset-2 ring-offset-white focus:shadow-none focus:ring-wp overflow-x-scroll"> | |
| 52 | + className="p-0 border flex items-start w-full text-left outline-none cursor-pointer no-underline ring-offset-2 ring-offset-white focus:shadow-none focus:ring-wp overflow-x-auto"> | |
| 47 | 53 | <span className="pointer-events-none w-full"> |
| 48 | 54 | <HeaderType |
| 49 | 55 | headerType={slug} |
| 50 | 56 | {...attributesWithoutHeaderType} |