Skip to content

Commit

Permalink
feat: Add theme variations - refs #153783
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanMiu committed Sep 26, 2022
1 parent 20652bc commit 70c0599
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/manage/Blocks/Accordion/AccordionEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default (props) => {
}, [data.collapsed]);

return (
<Accordion fluid styled>
<Accordion fluid styled className={data.theme}>
<React.Fragment>
<Accordion.Title
as={data.title_size}
Expand Down
17 changes: 17 additions & 0 deletions src/components/manage/Blocks/Accordion/Schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ const messages = defineMessages({
id: 'Accordion Title size',
defaultMessage: 'Accordion Title size',
},
theme: {
id: 'Theme',
defaultMessage: 'Theme',
},
right_arrows: {
id: 'Title Icon on the right',
defaultMessage: 'Title Icon on the right',
Expand Down Expand Up @@ -74,6 +78,7 @@ export const accordionBlockSchema = ({ intl }) => ({
fields: [
'title',
'title_size',
'theme',
'right_arrows',
'collapsed',
'non_exclusive',
Expand Down Expand Up @@ -104,6 +109,18 @@ export const accordionBlockSchema = ({ intl }) => ({
['h6', 'Heading 6'],
],
},
theme: {
title: intl.formatMessage(messages.theme),
type: 'string',
factory: 'Choice',
choices: [
['default', 'Default'],
['primary', 'Primary'],
['secondary', 'Secondary'],
['tertiary', 'Tertiary'],
],
default: 'default',
},
right_arrows: {
title: intl.formatMessage(messages.right_arrows),
type: 'boolean',
Expand Down
8 changes: 7 additions & 1 deletion src/components/manage/Blocks/Accordion/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ const View = (props) => {
<div className="accordion-block">
{panels.map(([id, panel], index) => {
return accordionBlockHasValue(panel) ? (
<Accordion fluid styled key={id} exclusive={!data.exclusive}>
<Accordion
fluid
styled
key={id}
exclusive={!data.exclusive}
className={data.theme}
>
<React.Fragment>
<Accordion.Title
as={data.title_size}
Expand Down
9 changes: 9 additions & 0 deletions src/components/manage/Blocks/Accordion/editor.less
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@
padding-top: 1rem;
padding-bottom: 0.1rem;
margin: 0;

.ui.accordion {
&.primary, &.secondary, &.tertiary {
.active.title input,
.active.title i {
color: #fff ;
}
}
}
}

.blocks-form {
Expand Down

0 comments on commit 70c0599

Please sign in to comment.