-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: add app.js banner #4183
Merged
Merged
docs: add app.js banner #4183
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7997c33
docs: draft appjs banner
kacperkapusciak 8ffc2ed
docs: make imgs not draggable
kacperkapusciak 114b621
docs: make banner responsive
kacperkapusciak 3f541f7
docs: show particles on every page
kacperkapusciak 3d59a76
docs: hide banner after app.js
kacperkapusciak 39d165f
docs: move X to top right corner on mobile
kacperkapusciak 4d110b5
docs: make docusaurus happy
kacperkapusciak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great content! 🥛