Skip to content

Commit b7077c7

Browse files
docs: fix State of React Native 2024 banner styles (#6840)
There was a **change request** from our design team considering the mobile styles of the State of React Native 2024 banner. ps. CSS is hard ### Before <img width="435" alt="image" src="https://github.com/user-attachments/assets/f35a9324-0fdb-46ec-93a9-b463629f5b12" /> ## After <img width="428" alt="image" src="https://github.com/user-attachments/assets/04f535fb-db46-4937-9945-462ea5336ac1" />
1 parent b2c5914 commit b7077c7

File tree

4 files changed

+61
-119
lines changed

4 files changed

+61
-119
lines changed

packages/docs-reanimated/src/theme/AnnouncementBar/Content/index.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ import clsx from 'clsx';
33
import ArrowButton from './ArrowButton';
44
import styles from './styles.module.css';
55
import useBaseUrl from '@docusaurus/useBaseUrl';
6+
import AnnouncementBarCloseButton from '@theme/AnnouncementBar/CloseButton';
67

78
export default function AnnouncementBarContent(props) {
9+
const { isCloseable, close } = props;
810
return (
911
<div className={clsx(styles.content, props.className)}>
10-
<div className={styles.wrapper}>
11-
<img
12-
className={styles.logo}
13-
src={useBaseUrl('/img/state-of-react-native-logo.svg')}
14-
alt="State of React Native logo"
15-
/>
16-
<strong className={styles.headline}>State of React Native 2024</strong>
17-
<p className={styles.subText}>
18-
Have a few minutes and want to shape the future of React Native?
19-
</p>
20-
</div>
12+
<img
13+
className={styles.logo}
14+
src={useBaseUrl('/img/state-of-react-native-logo.svg')}
15+
alt="State of React Native logo"
16+
/>
17+
<strong className={styles.headline}>State of React Native 2024</strong>
18+
<p className={styles.subText}>
19+
Have a few minutes and want to shape the future of React Native?
20+
</p>
2121
<a
2222
className={styles.link}
2323
href="https://survey.stateofreactnative.com/"
@@ -28,6 +28,9 @@ export default function AnnouncementBarContent(props) {
2828
<ArrowButton className={styles.linkArrow} />
2929
</div>
3030
</a>
31+
{isCloseable && (
32+
<AnnouncementBarCloseButton onClick={close} className={styles.close} />
33+
)}
3134
</div>
3235
);
3336
}

packages/docs-reanimated/src/theme/AnnouncementBar/Content/styles.module.css

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
.content {
2-
display: flex;
2+
display: grid;
3+
grid-template-columns: auto auto auto 1fr auto;
4+
grid-template-areas: 'logo headline subText link close';
35
align-items: center;
4-
justify-content: space-between;
6+
gap: 8px;
57
margin: 0 auto;
8+
width: 100%;
69
max-width: 1440px;
710

811
padding: 8px 16px;
@@ -11,26 +14,17 @@
1114
.logo {
1215
height: 36px;
1316
width: 36px;
14-
margin: auto;
1517
grid-area: logo;
1618
}
1719

1820
.content a {
1921
color: inherit;
2022
}
2123

22-
.wrapper {
23-
display: flex;
24-
flex-direction: row;
25-
gap: 8px;
26-
align-items: center;
27-
justify-content: center;
28-
}
29-
3024
.headline {
3125
font-size: 16px;
32-
grid-area: headline;
3326
text-wrap: nowrap;
27+
grid-area: headline;
3428
}
3529

3630
p.subText {
@@ -48,12 +42,16 @@ a.link {
4842
display: flex;
4943
flex-direction: row;
5044
align-items: center;
45+
justify-content: center;
5146
gap: 6px;
5247
font-size: 14px;
5348
padding: 4px 12px;
5449
border: 1px solid var(--swm-navy-light-100);
5550
background-color: var(--swm-navy-light-100);
56-
transition: all 0.2s ease-in-out;
51+
transition: border 0.2s ease-in-out, background-color 0.2s ease-in-out;
52+
grid-area: link;
53+
margin-left: auto;
54+
margin-right: 64px;
5755
}
5856

5957
.linkTitle {
@@ -86,32 +84,44 @@ a.link {
8684
align-items: center;
8785
}
8886

89-
@media screen and (max-width: 996px) {
87+
.close {
88+
opacity: 1;
89+
grid-area: close;
90+
}
91+
92+
.close svg g {
93+
stroke: var(--swm-navy-light-100);
94+
stroke-width: 2;
95+
}
96+
97+
@media screen and (max-width: 1200px) {
9098
.content {
91-
gap: 12px;
92-
}
93-
.wrapper {
94-
display: grid;
95-
grid-template-columns: 50px 1fr;
99+
grid-template-columns: auto 1fr 1fr auto;
96100
grid-template-areas:
97-
'logo headline'
98-
'logo subText';
99-
gap: 0;
100-
align-items: center;
101+
'logo headline link close'
102+
'logo subText link close';
103+
}
104+
.link {
105+
margin: auto;
101106
}
102107
}
103108

104-
@media screen and (max-width: 768px) {
109+
@media screen and (max-width: 600px) {
105110
.content {
106-
flex-direction: column;
107-
align-items: flex-start;
108-
padding: 8px 16px;
111+
grid-template-columns: auto 1fr auto;
112+
grid-template-areas:
113+
'logo headline close'
114+
'logo subText close'
115+
'link link link';
109116
}
110-
}
111-
112-
@media screen and (max-width: 450px) {
113117
.link {
114-
width: 100%;
115-
justify-content: center;
118+
margin: 0;
119+
}
120+
.logo {
121+
margin-bottom: auto;
122+
}
123+
.close {
124+
padding: 8px !important;
125+
margin-bottom: auto;
116126
}
117127
}

packages/docs-reanimated/src/theme/AnnouncementBar/index.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { useEffect, useState } from 'react';
22
import { useThemeConfig } from '@docusaurus/theme-common';
33
import { useAnnouncementBar } from '@docusaurus/theme-common/internal';
4-
import AnnouncementBarCloseButton from '@theme/AnnouncementBar/CloseButton';
54
import AnnouncementBarContent from '@theme/AnnouncementBar/Content';
65
import BrowserOnly from '@docusaurus/BrowserOnly';
76
import styles from './styles.module.css';
@@ -48,16 +47,11 @@ function AnnouncementBar() {
4847
className={styles.announcementBar}
4948
style={{ backgroundColor, color: textColor }}
5049
role="banner">
51-
{isCloseable && <div className={styles.announcementBarPlaceholder} />}
52-
<AnnouncementBarContent className={styles.announcementBarContent} />
53-
{isCloseable && (
54-
<div className={styles.buttonContainer}>
55-
<AnnouncementBarCloseButton
56-
onClick={close}
57-
className={styles.announcementBarClose}
58-
/>
59-
</div>
60-
)}
50+
<AnnouncementBarContent
51+
className={styles.announcementBarContent}
52+
isCloseable={isCloseable}
53+
close={close}
54+
/>
6155
</div>
6256
)}
6357
</BrowserOnly>

packages/docs-reanimated/src/theme/AnnouncementBar/styles.module.css

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -13,73 +13,8 @@
1313
z-index: 10;
1414
}
1515

16-
.announcementBarAdornment {
17-
height: 500px;
18-
width: 500px;
19-
position: absolute;
20-
opacity: 0.3;
21-
pointer-events: none;
22-
}
23-
24-
.announcementBarPlaceholder {
25-
flex: 0 0 30px;
26-
margin: 0 25px;
27-
}
28-
29-
.announcementBarClose {
30-
flex: 0 0 30px;
31-
margin: 0 25px;
32-
align-self: stretch;
33-
opacity: 1;
34-
}
35-
36-
.announcementBarClose svg g {
37-
stroke: var(--swm-navy-light-100);
38-
stroke-width: 2;
39-
}
40-
41-
.announcementBarContent {
42-
flex: 1 1 auto;
43-
}
44-
45-
.buttonContainer {
46-
display: flex;
47-
justify-content: center;
48-
padding-right: 1rem;
49-
}
50-
5116
@media print {
5217
.announcementBar {
5318
display: none;
5419
}
5520
}
56-
57-
@media screen and (max-width: 996px) {
58-
.announcementBarClose {
59-
margin: 0;
60-
}
61-
.announcementBarPlaceholder {
62-
display: none;
63-
}
64-
}
65-
@media screen and (max-width: 768px) {
66-
.buttonContainer {
67-
display: flex;
68-
flex-direction: column;
69-
justify-content: flex-start;
70-
padding-top: 1rem;
71-
}
72-
}
73-
@media screen and (max-width: 600px) {
74-
.announcementBarRightAdornment {
75-
display: none;
76-
}
77-
}
78-
79-
@media screen and (max-width: 450px) {
80-
.buttonContainer {
81-
padding-top: 0;
82-
align-items: center;
83-
justify-content: center;
84-
}
85-
}

0 commit comments

Comments
 (0)