Skip to content
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

refactor: switch to Flexbox in announcement bar #5430

Merged
merged 4 commits into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function AnnouncementBar(): JSX.Element | null {
className={styles.announcementBar}
style={{backgroundColor, color: textColor}}
role="banner">
{isCloseable && <div className={styles.announcementBarPlaceholder} />}
<div
className={clsx(styles.announcementBarContent, {
[styles.announcementBarCloseable]: isCloseable,
Expand All @@ -42,7 +43,7 @@ function AnnouncementBar(): JSX.Element | null {
{isCloseable ? (
<button
type="button"
className={clsx(styles.announcementBarClose, 'clean-btn')}
className={clsx('clean-btn close', styles.announcementBarClose)}
onClick={close}
aria-label={translate({
id: 'theme.AnnouncementBar.closeButtonAriaLabel',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
}

.announcementBar {
position: relative;
width: 100%;
display: flex;
align-items: center;
height: var(--docusaurus-announcement-bar-height);
background-color: var(--ifm-color-white);
color: var(--ifm-color-black);
Expand All @@ -22,51 +22,44 @@ html[data-announcement-bar-initially-dismissed='true'] .announcementBar {
display: none;
}

@media print {
.announcementBar {
display: none;
}
.announcementBarPlaceholder {
flex: 0 0 10px;
}

@media screen and (min-width: 1024px) {
:root {
--docusaurus-announcement-bar-height: 30px;
}
.announcementBarClose {
flex: 0 0 30px;
}

.announcementBarClose {
position: absolute;
right: 0;
top: 0;
width: 55px;
font-size: 1.25rem;
height: 100%;
align-self: stretch;
padding: 0;
}

.announcementBarContent {
flex: 1 1 auto;
font-size: 85%;
width: 100%;
text-align: center;
padding: 5px 0;
}

.announcementBarCloseable {
margin-right: 55px;
}

@media screen and (max-width: 576px) {
.announcementBarClose {
width: 35px;
}
.announcementBarContent {
width: auto;
}
.announcementBarCloseable {
margin-right: 35px;
@media print {
.announcementBar {
display: none;
}
}

.announcementBarContent a {
color: inherit;
text-decoration: underline;
}

@media screen and (min-width: 1024px) {
:root {
--docusaurus-announcement-bar-height: 30px;
}

.announcementBarPlaceholder,
.announcementBarClose {
flex-basis: 50px;
}
}