-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add AnnouncementBar for State of Gulp survey feat: Re-add American Express as a sponsor chore: Remove WordTips sponsor that dropped off in 2023 chore: Update content to reflect state of backer banner feat: Add Web Weekly sponsor
- Loading branch information
Showing
9 changed files
with
151 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import clsx from 'clsx'; | ||
import {translate} from '@docusaurus/Translate'; | ||
import IconClose from '@theme/Icon/Close'; | ||
import styles from './styles.module.css'; | ||
export default function AnnouncementBarCloseButton(props) { | ||
return ( | ||
<button | ||
type="button" | ||
aria-label={translate({ | ||
id: 'theme.AnnouncementBar.closeButtonAriaLabel', | ||
message: 'Close', | ||
description: 'The ARIA label for close button of announcement bar', | ||
})} | ||
{...props} | ||
className={clsx('clean-btn close', styles.closeButton, props.className)}> | ||
<IconClose width={14} height={14} strokeWidth={3.1} /> | ||
</button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.closeButton { | ||
padding: 0; | ||
line-height: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import clsx from 'clsx'; | ||
import {useThemeConfig} from '@docusaurus/theme-common'; | ||
import styles from './styles.module.css'; | ||
export default function AnnouncementBarContent(props) { | ||
const {announcementBar} = useThemeConfig(); | ||
const {content} = announcementBar; | ||
return ( | ||
<div | ||
{...props} | ||
className={clsx(styles.content, props.className)} | ||
// Developer provided the HTML, so assume it's safe. | ||
// eslint-disable-next-line react/no-danger | ||
dangerouslySetInnerHTML={{__html: content}} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.content { | ||
font-size: 1rem; | ||
text-align: center; | ||
padding: 5px 0; | ||
} | ||
|
||
.content a { | ||
color: var(--ifm-color-primary); | ||
text-decoration: underline; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import {useThemeConfig} from '@docusaurus/theme-common'; | ||
import {useAnnouncementBar} from '@docusaurus/theme-common/internal'; | ||
import AnnouncementBarCloseButton from '@theme/AnnouncementBar/CloseButton'; | ||
import AnnouncementBarContent from '@theme/AnnouncementBar/Content'; | ||
import styles from './styles.module.css'; | ||
export default function AnnouncementBar() { | ||
const {announcementBar} = useThemeConfig(); | ||
const {isActive, close} = useAnnouncementBar(); | ||
if (!isActive) { | ||
return null; | ||
} | ||
const {backgroundColor, textColor, isCloseable} = announcementBar; | ||
return ( | ||
<div | ||
className={styles.announcementBar} | ||
style={{backgroundColor, color: textColor}} | ||
role="banner"> | ||
{isCloseable && <div className={styles.announcementBarPlaceholder} />} | ||
<AnnouncementBarContent className={styles.announcementBarContent} /> | ||
{isCloseable && ( | ||
<AnnouncementBarCloseButton | ||
onClick={close} | ||
className={styles.announcementBarClose} | ||
/> | ||
)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.announcementBar { | ||
display: flex; | ||
align-items: center; | ||
height: 64px; | ||
background-color: var(--ifm-color-secondary); | ||
color: var(--ifm-color-white); | ||
} | ||
|
||
html[data-announcement-bar-initially-dismissed='true'] .announcementBar { | ||
display: none; | ||
} | ||
|
||
.announcementBarPlaceholder { | ||
flex: 0 0 10px; | ||
} | ||
|
||
.announcementBarClose { | ||
flex: 0 0 30px; | ||
align-self: stretch; | ||
} | ||
|
||
.announcementBarContent { | ||
flex: 1 1 auto; | ||
} | ||
|
||
@media print { | ||
.announcementBar { | ||
display: none; | ||
} | ||
} | ||
|
||
@media (min-width: 997px) { | ||
|
||
.announcementBarPlaceholder, | ||
.announcementBarClose { | ||
flex-basis: 50px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.