Skip to content

Commit fbdd4d6

Browse files
committed
Wrap
1 parent 12d909c commit fbdd4d6

2 files changed

Lines changed: 70 additions & 66 deletions

File tree

Lines changed: 9 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
import React from 'react';
2-
import { StyleSheet } from 'react-native';
32
import { useColorMode } from '@docusaurus/theme-common';
43

5-
const COLORS = {
6-
SWM_OFF_WHITE: '#f8f9ff',
7-
SWM_PURPLE_LIGHT_100: '#782aeb',
8-
SWM_NAVY_LIGHT_60: '#6676aa',
9-
SWM_NAVY: '#232736',
10-
};
4+
import styles from './styles.module.css';
5+
import clsx from 'clsx';
116

127
type HeaderWithBadgesProps = {
138
platforms?: ('android' | 'iOS' | 'web')[];
@@ -29,11 +24,11 @@ export function VersionBadge({ version }: VersionBadgeProps) {
2924

3025
return (
3126
<div
32-
style={{
33-
...styles.badge,
34-
...styles.versionBadge,
35-
...(isDark ? styles.versionBadgeDark : styles.versionBadgeLight),
36-
}}>
27+
className={clsx(
28+
styles.badge,
29+
styles.versionBadge,
30+
isDark ? styles.versionBadgeDark : styles.versionBadgeLight
31+
)}>
3732
Available from {version}
3833
</div>
3934
);
@@ -49,7 +44,7 @@ export function PlatformBadge({ platform }: PlatformBadgeProps) {
4944
? styles.webBadge
5045
: {};
5146

52-
return <div style={{ ...styles.badge, ...platformBadge }}>{platform}</div>;
47+
return <div className={clsx(styles.badge, platformBadge)}>{platform}</div>;
5348
}
5449

5550
export default function HeaderWithBadges({
@@ -58,7 +53,7 @@ export default function HeaderWithBadges({
5853
children,
5954
}: HeaderWithBadgesProps) {
6055
return (
61-
<div style={styles.container}>
56+
<div className={clsx(styles.headerWithBadges)}>
6257
{children}
6358

6459
{platforms
@@ -71,55 +66,3 @@ export default function HeaderWithBadges({
7166
</div>
7267
);
7368
}
74-
75-
const styles = StyleSheet.create({
76-
container: {
77-
display: 'flex',
78-
flexDirection: 'row',
79-
gap: 10,
80-
marginBottom: 20,
81-
},
82-
83-
badge: {
84-
borderRadius: 10,
85-
paddingTop: 2,
86-
paddingBottom: 2,
87-
paddingLeft: 10,
88-
paddingRight: 10,
89-
color: 'white',
90-
91-
display: 'flex',
92-
alignItems: 'center',
93-
justifyContent: 'space-around',
94-
},
95-
96-
androidBadge: {
97-
backgroundColor: '#0f8142',
98-
},
99-
100-
iosBadge: {
101-
backgroundColor: '#000000',
102-
},
103-
104-
webBadge: {
105-
backgroundColor: '#1067c4',
106-
},
107-
108-
versionBadge: {
109-
marginLeft: 'auto',
110-
borderWidth: 1,
111-
borderStyle: 'solid',
112-
},
113-
114-
versionBadgeLight: {
115-
borderColor: COLORS.SWM_PURPLE_LIGHT_100,
116-
backgroundColor: COLORS.SWM_OFF_WHITE,
117-
color: COLORS.SWM_PURPLE_LIGHT_100,
118-
},
119-
120-
versionBadgeDark: {
121-
borderColor: COLORS.SWM_NAVY_LIGHT_60,
122-
backgroundColor: COLORS.SWM_NAVY,
123-
color: COLORS.SWM_OFF_WHITE,
124-
},
125-
});
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
.headerWithBadges {
2+
display: flex;
3+
flex-direction: row;
4+
gap: 10px;
5+
margin-bottom: 20px;
6+
}
7+
8+
.badge {
9+
border-radius: 16px;
10+
padding: 2px 10px;
11+
color: white;
12+
display: flex;
13+
align-items: center;
14+
justify-content: space-around;
15+
}
16+
17+
.androidBadge {
18+
background-color: #0f8142;
19+
}
20+
21+
.iosBadge {
22+
background-color: #000000;
23+
}
24+
25+
.webBadge {
26+
background-color: #1067c4;
27+
}
28+
29+
.versionBadge {
30+
margin-left: auto;
31+
border-width: 1px;
32+
border-style: solid;
33+
}
34+
35+
.versionBadgeLight {
36+
border-color: var(--swm-purple-light-100);
37+
background-color: var(--swm-off-white);
38+
color: var(--swm-purple-light-100);
39+
}
40+
41+
.versionBadgeDark {
42+
border-color: var(--swm-navy-light-60);
43+
background-color: var(--swm-navy);
44+
color: var(--swm-off-white);
45+
}
46+
47+
@media (max-width: 420px) {
48+
.headerWithBadges {
49+
display: flex;
50+
flex-direction: row;
51+
flex-wrap: wrap;
52+
gap: 10px;
53+
margin-bottom: 20px;
54+
}
55+
56+
.versionBadge {
57+
margin-left: 0px;
58+
border-width: 1px;
59+
border-style: solid;
60+
}
61+
}

0 commit comments

Comments
 (0)