File tree Expand file tree Collapse file tree 2 files changed +25
-31
lines changed
packages/docusaurus-theme-classic/src/theme/AnnouncementBar Expand file tree Collapse file tree 2 files changed +25
-31
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ function AnnouncementBar(): JSX.Element | null {
31
31
className = { styles . announcementBar }
32
32
style = { { backgroundColor, color : textColor } }
33
33
role = "banner" >
34
+ { isCloseable && < div className = { styles . announcementBarPlaceholder } /> }
34
35
< div
35
36
className = { clsx ( styles . announcementBarContent , {
36
37
[ styles . announcementBarCloseable ] : isCloseable ,
@@ -42,7 +43,7 @@ function AnnouncementBar(): JSX.Element | null {
42
43
{ isCloseable ? (
43
44
< button
44
45
type = "button"
45
- className = { clsx ( styles . announcementBarClose , 'clean-btn' ) }
46
+ className = { clsx ( 'clean-btn close' , styles . announcementBarClose ) }
46
47
onClick = { close }
47
48
aria-label = { translate ( {
48
49
id : 'theme.AnnouncementBar.closeButtonAriaLabel' ,
Original file line number Diff line number Diff line change 10
10
}
11
11
12
12
.announcementBar {
13
- position : relative ;
14
- width : 100 % ;
13
+ display : flex ;
14
+ align-items : center ;
15
15
height : var (--docusaurus-announcement-bar-height );
16
16
background-color : var (--ifm-color-white );
17
17
color : var (--ifm-color-black );
@@ -22,51 +22,44 @@ html[data-announcement-bar-initially-dismissed='true'] .announcementBar {
22
22
display : none;
23
23
}
24
24
25
- @media print {
26
- .announcementBar {
27
- display : none;
28
- }
25
+ .announcementBarPlaceholder {
26
+ flex : 0 0 10px ;
29
27
}
30
28
31
- @media screen and (min-width : 1024px ) {
32
- : root {
33
- --docusaurus-announcement-bar-height : 30px ;
34
- }
29
+ .announcementBarClose {
30
+ flex : 0 0 30px ;
35
31
}
36
32
37
33
.announcementBarClose {
38
- position : absolute;
39
- right : 0 ;
40
- top : 0 ;
41
- width : 55px ;
42
- font-size : 1.25rem ;
43
- height : 100% ;
34
+ align-self : stretch;
35
+ padding : 0 ;
44
36
}
45
37
46
38
.announcementBarContent {
39
+ flex : 1 1 auto;
47
40
font-size : 85% ;
48
- width : 100% ;
49
41
text-align : center;
50
42
padding : 5px 0 ;
51
43
}
52
44
53
- .announcementBarCloseable {
54
- margin-right : 55px ;
55
- }
56
-
57
- @media screen and (max-width : 576px ) {
58
- .announcementBarClose {
59
- width : 35px ;
60
- }
61
- .announcementBarContent {
62
- width : auto;
63
- }
64
- .announcementBarCloseable {
65
- margin-right : 35px ;
45
+ @media print {
46
+ .announcementBar {
47
+ display : none;
66
48
}
67
49
}
68
50
69
51
.announcementBarContent a {
70
52
color : inherit;
71
53
text-decoration : underline;
72
54
}
55
+
56
+ @media screen and (min-width : 1024px ) {
57
+ : root {
58
+ --docusaurus-announcement-bar-height : 30px ;
59
+ }
60
+
61
+ .announcementBarPlaceholder ,
62
+ .announcementBarClose {
63
+ flex-basis : 50px ;
64
+ }
65
+ }
You can’t perform that action at this time.
0 commit comments