diff --git a/src/components/announcement/_announcement.scss b/src/components/announcement/_announcement.scss new file mode 100644 index 00000000..6218b720 --- /dev/null +++ b/src/components/announcement/_announcement.scss @@ -0,0 +1,82 @@ +.announcement { + display: flex; + align-items: center; + column-gap: var(--spacing-xl); + padding: var(--spacing-xl); +} + +.announcement__image { + width: 3.5rem; +} + +.announcement__content { + flex: 1; + display: flex; + flex-direction: column; + + .heading { + @include heading-small; + + margin: 0 0 var(--spacing-sm); + color: var(--color-primary-darker); + } + + p { + margin: 0; + color: var(--color-text-body); + font-size: var(--font-size-small); + } +} + +.announcement__action button { + font-size: var(--font-size-small); +} + +.announcement-list { + display: flex; + flex-direction: column; + row-gap: var(--spacing-xl); +} + +/* Variants -- Default style for announcements */ +.announcement--default { + background-color: var(--color-primary-lighter); +} + +.announcement__content--default .heading { + color: var(--color-primary-darker); +} + +.announcement__content--default p { + color: var(--color-text-body); +} + +/* Variants -- Light style for announcements */ +.announcement--light { + background-color: var(--color-white); +} + +.announcement__content--light .heading { + color: var(--color-primary-darker); +} + +.announcement__content--light p { + color: var(--color-text-body); +} + +/* Variants -- Dark style for announcements */ +.announcement--dark { + background-color: var(--color-primary-darker); +} + +.announcement__content--dark p, +.announcement__content--dark .heading { + color: var(--color-primary-lighter); +} + +.announcement__action--dark button, +.announcement__action--dark button:hover, +.announcement__action--dark button:focus { + color: var(--color-primary-darker); + background-color: var(--color-primary-lighter); +} diff --git a/src/components/announcement/announcement.component.yml b/src/components/announcement/announcement.component.yml new file mode 100644 index 00000000..5f1ec0a7 --- /dev/null +++ b/src/components/announcement/announcement.component.yml @@ -0,0 +1,98 @@ +$schema: https://git.drupalcode.org/project/drupal/-/raw/10.1.x/core/modules/sdc/src/metadata.schema.json + +name: Announcement +group: Components +status: stable +props: + type: object + required: + - announcement__title + - announcement__content + properties: + announcement__title: + type: string + title: Title + description: 'Specifies the title of the announcement' + data: 'This is an announcement title' + announcement__content: + type: string + title: Content + description: 'Specifies the main content of the announcement' + data: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec vestibulum libero. Curabitur suscipit feugiat ipsum, vel auctor nunc.' + announcement__button_text: + type: string + title: Button Text + description: 'Specifies the text displayed on the button' + data: 'Go to site' + announcement__button_url: + type: string + title: Button URL + description: 'Specifies the URL the button will link to' + data: '#' + announcement__icon: + type: string + title: Icon + description: '(Optional) Specifies the URL of the icon image for the announcement' + data: 'https://placehold.co/60x60' + announcement__variant: + type: string + title: Variant + description: 'Specifies the style variant for the announcement component' + enum: + - default + - light + - dark + data: 'default' + example: + - announcement__title: 'This is an announcement title' + announcement__content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec vestibulum libero. Curabitur suscipit feugiat ipsum, vel auctor nunc.' + announcement__button_text: 'Go to site' + announcement__button_url: '#' + announcement__icon: 'icon-dark' + - announcement__title: 'This is an announcement title' + announcement__content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec vestibulum libero. Curabitur suscipit feugiat ipsum, vel auctor nunc.' + announcement__icon: 'icon-dark' + - announcement__title: 'This is an announcement title' + announcement__content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec vestibulum libero. Curabitur suscipit feugiat ipsum, vel auctor nunc.' + announcement__button_text: 'Go to site' + announcement__button_url: '#' + - announcement__title: 'This is an announcement title' + announcement__content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec vestibulum libero. Curabitur suscipit feugiat ipsum, vel auctor nunc.' + + - announcement__title: 'This is an announcement title' + announcement__content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec vestibulum libero. Curabitur suscipit feugiat ipsum, vel auctor nunc.' + announcement__button_text: 'Go to site' + announcement__button_url: '#' + announcement__icon: 'icon-dark' + announcement__variant: 'light' + - announcement__title: 'This is an announcement title' + announcement__content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec vestibulum libero. Curabitur suscipit feugiat ipsum, vel auctor nunc.' + announcement__icon: 'icon-dark' + announcement__variant: 'light' + - announcement__title: 'This is an announcement title' + announcement__content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec vestibulum libero. Curabitur suscipit feugiat ipsum, vel auctor nunc.' + announcement__button_text: 'Go to site' + announcement__button_url: '#' + announcement__variant: 'light' + - announcement__title: 'This is an announcement title' + announcement__content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec vestibulum libero. Curabitur suscipit feugiat ipsum, vel auctor nunc.' + announcement__variant: 'light' + + - announcement__title: 'This is an announcement title' + announcement__content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec vestibulum libero. Curabitur suscipit feugiat ipsum, vel auctor nunc.' + announcement__button_text: 'Go to site' + announcement__button_url: '#' + announcement__icon: 'icon-light' + announcement__variant: 'dark' + - announcement__title: 'This is an announcement title' + announcement__content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec vestibulum libero. Curabitur suscipit feugiat ipsum, vel auctor nunc.' + announcement__icon: 'icon-light' + announcement__variant: 'dark' + - announcement__title: 'This is an announcement title' + announcement__content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec vestibulum libero. Curabitur suscipit feugiat ipsum, vel auctor nunc.' + announcement__button_text: 'Go to site' + announcement__button_url: '#' + announcement__variant: 'dark' + - announcement__title: 'This is an announcement title' + announcement__content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec vestibulum libero. Curabitur suscipit feugiat ipsum, vel auctor nunc.' + announcement__variant: 'dark' diff --git a/src/components/announcement/announcement.stories.js b/src/components/announcement/announcement.stories.js new file mode 100644 index 00000000..275f838f --- /dev/null +++ b/src/components/announcement/announcement.stories.js @@ -0,0 +1,30 @@ +import announcementTwig from './announcement.twig'; +import { props } from './announcement.component.yml'; +import announcementDarkIcon from '../../images/example/announcement-icon--dark.svg'; +import announcementLightIcon from '../../images/example/announcement-icon--light.svg'; + +export default { + title: 'Components/Announcement', + decorators: [ + (story) => + `
{{ announcement__content }}
+