Skip to content

Commit

Permalink
feature: Divider has spacing sizes now
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiggr committed Apr 5, 2023
1 parent a8d2db5 commit bf813c4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
19 changes: 18 additions & 1 deletion src/components/Divider/Schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ const messages = defineMessages({
id: 'A divider can have its colors inverted.',
defaultMessage: 'A divider can have its colors inverted.',
},
Spacing: {
id: 'Spacing',
defaultMessage: 'Spacing',
},
});

export const DividerEditSchema = ({ intl }) => ({
Expand All @@ -95,7 +99,15 @@ export const DividerEditSchema = ({ intl }) => ({
{
id: 'default',
title: 'Default',
fields: ['title', 'text', 'hidden', 'section', 'fitted', 'short'],
fields: [
'title',
'text',
'hidden',
'section',
'fitted',
'short',
'spacing',
],
},
],

Expand Down Expand Up @@ -128,6 +140,11 @@ export const DividerEditSchema = ({ intl }) => ({
description: intl.formatMessage(messages.ShortHelp),
type: 'boolean',
},
spacing: {
title: intl.formatMessage(messages.Spacing),
widget: 'image_size',
default: 's',
},
},
required: [],
});
Expand Down
6 changes: 5 additions & 1 deletion src/components/Divider/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ export default ({ data }) => (
hidden={data.hidden}
section={data.section}
fitted={data.fitted}
className={cx(data.styles?.theme, data.short ? 'short' : '')}
className={cx(
data.styles?.theme,
data.short ? 'short' : '',
data?.spacing ? `divider-spacing-${data?.spacing}` : '',
)}
horizontal={!!data.text}
inverted={data.styles?.inverted}
>
Expand Down
14 changes: 14 additions & 0 deletions src/components/Divider/divider.less
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,17 @@
width: 50%;
margin-inline: auto;
}

.ui.divider {
&.divider-spacing-s {
margin: 1rem 0;
}

&.divider-spacing-m {
margin: 1.5rem 0;
}

&.divider-spacing-l {
margin: 2rem 0;
}
}

0 comments on commit bf813c4

Please sign in to comment.