Skip to content

Commit

Permalink
feat: added text aligment option
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanMiu committed Jun 8, 2023
1 parent 3dc3490 commit 10dc32d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/StatisticBlock/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const View = ({ data, mode }) => {
animation = {},
} = data;
const {
textAlign = 'center',
backgroundInverted = 'primary',
valueVariation = 'secondary',
labelVariation = 'tertiary',
Expand All @@ -70,7 +71,7 @@ const View = ({ data, mode }) => {
valuevariation={valueVariation}
labelvariation={labelVariation}
extravariation={extraVariation}
className={styles.align === 'full' ? 'ui container' : ''}
className={cx(textAlign, { 'ui container': styles.align === 'full' })}
>
{items.map((item, index) => {
const href = getFieldURL(item.href);
Expand Down
30 changes: 25 additions & 5 deletions src/StatisticBlock/styles.less
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
.ui.statistic {
.slate {
p {
margin-bottom: 0;
color: inherit;
.ui.statistics {
.ui.statistic {
.slate {
p {
margin-bottom: 0;
color: inherit;
}
}
}

&.left {
.ui.statistic {
align-items: flex-start;
}
}

&.center {
.ui.statistic {
align-items: center;
}
}

&.right {
.ui.statistic {
align-items: flex-end;
}
}
}
6 changes: 6 additions & 0 deletions src/StatisticBlock/stylesSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default () => {
title: 'Default',
fields: [
'align',
'textAlign',
'backgroundInverted',
'valueVariation',
'labelVariation',
Expand All @@ -20,6 +21,11 @@ export default () => {
title: 'Align',
actions: ['center', 'wide', 'full'],
},
textAlign: {
title: 'Text align',
widget: 'style_text_align',
default: 'center',
},
backgroundInverted: {
title: 'Background when inverted',
choices: [
Expand Down

0 comments on commit 10dc32d

Please sign in to comment.