Skip to content

Commit

Permalink
feat(copyright): Add copyright prefix - Image - refs #250724
Browse files Browse the repository at this point in the history
  • Loading branch information
avoinea committed Mar 27, 2023
1 parent a647311 commit 6a72772
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 12 deletions.
12 changes: 10 additions & 2 deletions src/ui/Banner/Banner.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ export default {
type: { summary: 'string' },
},
},
copyrightPrefix: {
table: {
category: 'Copyright',
defaultValue: { summary: '' },
type: { summary: 'string' },
},
},
copyrightIcon: {
table: {
category: 'Copyright',
Expand All @@ -60,7 +67,6 @@ export default {
},
},
copyrightPosition: {
name: 'Position',
control: {
type: 'inline-radio',
options: ['left', 'right'],
Expand Down Expand Up @@ -141,6 +147,7 @@ const Template = (args) => {
</Banner.Metadata>
)}
<Copyright copyrightPosition={args.copyrightPosition}>
<Copyright.Prefix>{args.copyrightPrefix}</Copyright.Prefix>
<Copyright.Icon>
<Icon className={args.copyrightIcon} />
</Copyright.Icon>
Expand All @@ -164,7 +171,8 @@ Default.args = {
image: true,
hideShareButton: false,
hideDownloadButton: false,
copyrightPrefix: 'Image',
copyrightPosition: 'left',
copyrightIcon: 'ri-copyright-line',
copyright: 'Image copyright: Velit fusce sed sem ut.',
copyright: 'John Smith, Well with Nature /EEA',
};
9 changes: 9 additions & 0 deletions src/ui/Copyright/Copyright.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ function Copyright({ children, ...rest }) {
);
}

Copyright.Prefix = ({ children, ...rest }) =>
children ? (
<span {...rest} className={'icon-prefix'}>
{children}
</span>
) : (
''
);

Copyright.Icon = ({ children, ...rest }) => (
<span {...rest} className={'icon-wrapper'}>
{children}
Expand Down
11 changes: 6 additions & 5 deletions src/ui/Copyright/Copyright.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export default {
component: Copyright,
argTypes: {
copyrightPosition: {
name: 'Position',
control: {
type: 'inline-radio',
options: ['left', 'right'],
Expand All @@ -24,17 +23,19 @@ export const Default = (args) => (
<Container>
<Segment className={'inverted'}>
<Copyright copyrightPosition={args.copyrightPosition}>
<Copyright.Prefix>{args.copyrightPrefix}</Copyright.Prefix>
<Copyright.Icon>
<Icon className={args.icon} />
<Icon className={args.copyrightIcon} />
</Copyright.Icon>
<Copyright.Text>{args.text}</Copyright.Text>
<Copyright.Text>{args.copyright}</Copyright.Text>
</Copyright>
</Segment>
</Container>
);

Default.args = {
copyrightPosition: 'left',
icon: 'ri-copyright-line',
text: 'Image copyright: Velit fusce sed sem ut.',
copyrightPrefix: 'Image',
copyrightIcon: 'ri-copyright-line',
copyright: 'John Smith, Well with Nature /EEA',
};
3 changes: 2 additions & 1 deletion src/ui/Hero/Hero.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ function Hero({
alignContent,
backgroundVariant,
children,

has_copyright,
copyright,
copyrightPrefix,
copyrightIcon,
copyrightPosition,
}) {
Expand All @@ -49,6 +49,7 @@ function Hero({

{has_copyright && (
<Copyright copyrightPosition={copyrightPosition}>
<Copyright.Prefix>{copyrightPrefix}</Copyright.Prefix>
<Copyright.Icon>
<Icon className={copyrightIcon} />
</Copyright.Icon>
Expand Down
21 changes: 18 additions & 3 deletions src/ui/Hero/Hero.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export default {
},
},
copyrightPosition: {
name: 'Position',
control: {
type: 'inline-radio',
options: ['left', 'right'],
Expand All @@ -74,6 +73,13 @@ export default {
defaultValue: { summary: '"left"' },
},
},
copyrightPrefix: {
table: {
category: 'Copyright',
defaultValue: { summary: '""' },
type: { summary: 'string' },
},
},
copyrightIcon: {
table: {
category: 'Copyright',
Expand Down Expand Up @@ -130,8 +136,9 @@ Default.args = {

has_copyright: true,
copyrightPosition: 'left',
copyrightPrefix: 'Image',
copyrightIcon: 'ri-copyright-line',
copyright: 'Image copyright: Velit fusce sed sem ut.',
copyright: 'John Smith, Well with Nature /EEA',
};
Default.parameters = {
controls: {
Expand Down Expand Up @@ -167,8 +174,9 @@ Playground.args = {

has_copyright: true,
copyrightPosition: 'left',
copyrightPrefix: 'Image',
copyrightIcon: 'ri-copyright-line',
copyright: 'Image copyright: Velit fusce sed sem ut.',
copyright: 'John Smith, Well with Nature /EEA',
};
Playground.argTypes = {
fullWidth: {
Expand Down Expand Up @@ -253,6 +261,13 @@ Playground.argTypes = {
type: { summary: 'string' },
},
},
copyrightPrefix: {
table: {
category: 'Copyright',
defaultValue: { summary: '""' },
type: { summary: 'string' },
},
},
copyrightIcon: {
table: {
category: 'Copyright',
Expand Down
2 changes: 1 addition & 1 deletion theme/themes/eea/extras/copyright.variables
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@copyrightWrapperPaddingRight: @rem-space-3;
@copyrightWrapperBottom: @rem-space-4;
@copyrightMinHeight: @rem-space-8;
@copyrightAlignItems: center;
@copyrightAlignItems: start;

/* Image block */
@floatImageLeftMaxWidth: 50%;
Expand Down

0 comments on commit 6a72772

Please sign in to comment.