Skip to content

Commit

Permalink
refactor: switch to Flexbox in announcement bar (#5430)
Browse files Browse the repository at this point in the history
* refactor: switch to Flexbox in announcement bar

* Fixes after review

* Fixes after review

* Fixes after review
  • Loading branch information
lex111 authored Aug 30, 2021
1 parent df3752c commit a9e0e99
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 31 deletions.
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;
}
}

0 comments on commit a9e0e99

Please sign in to comment.