-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Summary This PR adds banner announcing app.js conf. The banner is easily dismissable and will disappear automatically after the conference. ### Screenshots ##### X Large screen ![image](https://user-images.githubusercontent.com/39658211/223506267-de56f51f-e517-477c-ae31-5aaad293a629.png) ##### Large screen <img width="721" alt="image" src="https://user-images.githubusercontent.com/39658211/223506461-b92c6a1f-1794-4a6f-ae54-01436bdcd729.png"> ##### Tablet ![image](https://user-images.githubusercontent.com/39658211/223508037-c192d3f2-039f-496c-8e59-9063546723f9.png) ##### Mobile ![image](https://user-images.githubusercontent.com/39658211/223508080-f678c7df-1c84-4834-be74-a5f123eadb7a.png)
- Loading branch information
1 parent
6abbdc7
commit 79b699a
Showing
8 changed files
with
355 additions
and
0 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> | ||
); | ||
} |
19 changes: 19 additions & 0 deletions
19
docs/src/theme/AnnouncementBar/CloseButton/styles.module.css
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,19 @@ | ||
.closeButton { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
padding: 0; | ||
line-height: 0; | ||
z-index: 1; | ||
} | ||
|
||
.closeButton svg { | ||
color: white; | ||
} | ||
|
||
@media screen and (max-width: 996px) { | ||
.closeButton { | ||
align-items: flex-start; | ||
padding: 24px; | ||
} | ||
} |
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,23 @@ | ||
import React from 'react'; | ||
import clsx from 'clsx'; | ||
import styles from './styles.module.css'; | ||
|
||
export default function AnnouncementBarContent(props) { | ||
return ( | ||
<div {...props} className={clsx(styles.content, props.className)}> | ||
<div className={styles.wrapper}> | ||
<strong className={styles.headline}>We're organizing app.js</strong> | ||
<p className={styles.subText}> | ||
a React Native & Expo-focused conference | ||
</p> | ||
</div> | ||
<a | ||
className={styles.link} | ||
href="https://appjs.co/" | ||
target="_blank" | ||
rel="noreferrer noopener"> | ||
Learn more | ||
</a> | ||
</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,69 @@ | ||
.content { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
margin: 0 auto; | ||
max-width: 1440px; | ||
|
||
padding: 10px 0; | ||
} | ||
|
||
.content a { | ||
color: inherit; | ||
text-decoration: underline; | ||
} | ||
.wrapper { | ||
display: flex; | ||
align-items: flex-end; | ||
justify-content: center; | ||
} | ||
|
||
.headline { | ||
margin-right: 8px; | ||
} | ||
|
||
.subText { | ||
margin: 0; | ||
} | ||
|
||
.subText::before { | ||
content: ' - '; | ||
} | ||
|
||
.link { | ||
font-size: 20px; | ||
} | ||
|
||
@media screen and (max-width: 996px) { | ||
.content { | ||
flex-direction: column; | ||
align-items: flex-start; | ||
padding: 20px 24px; | ||
} | ||
.wrapper { | ||
flex-direction: column; | ||
align-items: flex-start; | ||
margin-bottom: 8px; | ||
} | ||
.headline, | ||
.subText { | ||
font-size: 20px; | ||
} | ||
|
||
.subText::before { | ||
content: ''; | ||
} | ||
.link { | ||
font-size: 16px; | ||
} | ||
} | ||
@media screen and (max-width: 600px) { | ||
.headline, | ||
.subText { | ||
font-size: 16px; | ||
} | ||
|
||
.link { | ||
font-size: 14px; | ||
} | ||
} |
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,48 @@ | ||
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'; | ||
import Particles from './particles.svg'; | ||
|
||
export default function AnnouncementBar() { | ||
const { announcementBar } = useThemeConfig(); | ||
const { isActive, close } = useAnnouncementBar(); | ||
if (!isActive) { | ||
return null; | ||
} | ||
const { backgroundColor, textColor, isCloseable } = announcementBar; | ||
|
||
// hide announcement bar after app.js | ||
const today = new Date(); | ||
const endOfAppJS = new Date('2023-05-13T00:00:00.000Z'); | ||
if (today > endOfAppJS) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div | ||
className={styles.announcementBar} | ||
style={{ | ||
backgroundColor, | ||
color: textColor, | ||
}} | ||
role="banner"> | ||
<Particles | ||
className={`${styles.announcementBarAdornment} ${styles.announcementBarLeftAdornment}`} | ||
/> | ||
{isCloseable && <div className={styles.announcementBarPlaceholder} />} | ||
<AnnouncementBarContent className={styles.announcementBarContent} /> | ||
{isCloseable && ( | ||
<AnnouncementBarCloseButton | ||
onClick={close} | ||
className={styles.announcementBarClose} | ||
/> | ||
)} | ||
<Particles | ||
className={`${styles.announcementBarAdornment} ${styles.announcementBarRightAdornment}`} | ||
/> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.