This repository has been archived by the owner on Dec 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathindex.tsx
71 lines (60 loc) · 1.56 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import {ButtonGroup, ThemeProvider} from 'dooboo-ui';
import React, {ReactElement, useState} from 'react';
import {View} from 'react-native';
import styled from '@emotion/native';
const Container = styled.SafeAreaView`
flex: 1;
align-self: stretch;
background-color: ${({theme}) => theme.background};
align-self: stretch;
padding: 0 24px;
flex-direction: column;
align-items: center;
justify-content: center;
`;
const StyledText = styled.Text`
color: ${({theme}) => theme.text};
font-size: 32px;
`;
const ButtonGroupStory = (): React.ReactElement => {
const data = ['Option 1', 'Option 2', 'Option 3', 'Option 4'];
const [option, setOption] = useState('Option 1');
const selectOption = (index: number): void => {
setOption(data[index]);
switch (index) {
case 0:
setOption('Option 1');
break;
case 1:
setOption('Option 2');
break;
}
};
return (
<Container>
<ButtonGroup
style={{marginTop: 40, marginHorizontal: 20}}
onPress={(index: number): void => selectOption(index)}
data={data}
/>
<View
style={{
height: 120,
justifyContent: 'center',
alignItems: 'center',
}}>
<StyledText>{option}</StyledText>
</View>
</Container>
);
};
export const Light = (): ReactElement => (
<ThemeProvider initialThemeType="light">
<ButtonGroupStory />
</ThemeProvider>
);
export const Dark = (): ReactElement => (
<ThemeProvider initialThemeType="dark">
<ButtonGroupStory />
</ThemeProvider>
);