diff --git a/ghost/admin-x-settings/src/admin-x-ds/global/Checkbox.stories.tsx b/ghost/admin-x-settings/src/admin-x-ds/global/Checkbox.stories.tsx index 2e1fbacf94..28d6616803 100644 --- a/ghost/admin-x-settings/src/admin-x-ds/global/Checkbox.stories.tsx +++ b/ghost/admin-x-settings/src/admin-x-ds/global/Checkbox.stories.tsx @@ -32,3 +32,13 @@ export const WithTitleAndHint: Story = { checked: true } }; + +export const WithSeparator: Story = { + args: { + title: 'Title', + label: 'Checkbox 1', + hint: 'Here\'s some hint', + checked: true, + separator: true + } +}; diff --git a/ghost/admin-x-settings/src/admin-x-ds/global/Checkbox.tsx b/ghost/admin-x-settings/src/admin-x-ds/global/Checkbox.tsx index e8bac714d6..5924f17485 100644 --- a/ghost/admin-x-settings/src/admin-x-ds/global/Checkbox.tsx +++ b/ghost/admin-x-settings/src/admin-x-ds/global/Checkbox.tsx @@ -1,6 +1,7 @@ import Heading from './Heading'; import Hint from './Hint'; import React, {useEffect, useState} from 'react'; +import Separator from './Separator'; interface CheckboxProps { id: string; @@ -11,9 +12,10 @@ interface CheckboxProps { error?:boolean; hint?: React.ReactNode; checked?: boolean; + separator?: boolean; } -const Checkbox: React.FC = ({id, title, label, value, onChange, error, hint, checked}) => { +const Checkbox: React.FC = ({id, title, label, value, onChange, error, hint, checked, separator}) => { const [isChecked, setIsChecked] = useState(checked); useEffect(() => { @@ -27,22 +29,25 @@ const Checkbox: React.FC = ({id, title, label, value, onChange, e }; return ( -
- {title && {title}} - +
+
+ {title && {title}} + +
+ {(separator || error) && }
); }; diff --git a/ghost/admin-x-settings/src/admin-x-ds/global/Radio.stories.tsx b/ghost/admin-x-settings/src/admin-x-ds/global/Radio.stories.tsx index a2f058db62..1177bda363 100644 --- a/ghost/admin-x-settings/src/admin-x-ds/global/Radio.stories.tsx +++ b/ghost/admin-x-settings/src/admin-x-ds/global/Radio.stories.tsx @@ -55,3 +55,12 @@ export const OptionHints: Story = { defaultSelectedOption: 'option-1' } }; + +export const WithSeparator: Story = { + args: { + title: 'Title', + options: radioOptionsWithHints, + defaultSelectedOption: 'option-1', + separator: true + } +}; diff --git a/ghost/admin-x-settings/src/admin-x-ds/global/Radio.tsx b/ghost/admin-x-settings/src/admin-x-ds/global/Radio.tsx index 21ac840fe1..12b57ffd99 100644 --- a/ghost/admin-x-settings/src/admin-x-ds/global/Radio.tsx +++ b/ghost/admin-x-settings/src/admin-x-ds/global/Radio.tsx @@ -1,6 +1,7 @@ import Heading from './Heading'; import Hint from './Hint'; import React, {useEffect, useState} from 'react'; +import Separator from './Separator'; export interface RadioOption { value: string; @@ -16,9 +17,10 @@ interface RadioProps { error?:boolean; hint?: React.ReactNode; defaultSelectedOption?: string; + separator?: boolean; } -const Radio: React.FC = ({id, title, options, onSelect, error, hint, defaultSelectedOption}) => { +const Radio: React.FC = ({id, title, options, onSelect, error, hint, defaultSelectedOption, separator}) => { const [selectedOption, setSelectedOption] = useState(defaultSelectedOption); useEffect(() => { @@ -34,26 +36,29 @@ const Radio: React.FC = ({id, title, options, onSelect, error, hint, }; return ( -
- {title && {title}} - {options.map(option => ( - - ))} - {hint && {hint}} +
+
+ {title && {title}} + {options.map(option => ( + + ))} + {hint && {hint}} +
+ {(separator || error) && }
); };