Etch component
Announcement 1
A bar with one short announcement: a label with an icon, a line of text and a "Read More" that opens the news behind it.
Documentation
A bar with one short announcement: a label with an icon, a line of text and a call to action, such as "Read More", that opens the news behind it.
How to use it
- Write the announcement in Text, one short sentence.
- Set Link to the page with the details, such as the news post. The whole bar becomes the link, and the CTA group's Label, such as "Read More", shows at its end. Without a link, the bar is text only.
- Label names the bar, such as "Announcement", and Icon goes in the label, such as a bell. Leave either empty to hide it.
Good to know
- On phones the label sits above the text.
- To show the latest news post, put the bar in a loop of one post, and bind Text to the post's title and Link to its address:
{post.title}and{post.permalink.relative}when the loop's item is namedpost. With no post, no bar shows.
CSS recipes
--mac-announcement-1-background and --mac-announcement-1-text set the bar's colors (--primary-light and --primary-dark), and --mac-announcement-1-label-background and --mac-announcement-1-label-text the label's (--primary and --text-light). A recipe changes every Announcement 1 on the site: paste it in the site's main stylesheet, which Etch prints after the components' styles.
On the brand color
For a bar that should catch the eye: the primary, its text light and its label white.
/* The bar on the primary, its text light, its label white */
.mac-announcement-1 {
--mac-announcement-1-background: var(--primary);
--mac-announcement-1-text: var(--text-light);
--mac-announcement-1-label-background: var(--white);
--mac-announcement-1-label-text: var(--primary);
/* The focus ring light, seen on the primary */
--focus-color: var(--text-light);
}