@tactics/toddle-styleguide 1.4.16 → 1.4.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.tsx +8 -0
- package/index.tsx +3 -1
- package/package.json +1 -1
- package/src/components/atoms/count/count.component.tsx +20 -0
- package/src/components/atoms/count/count.preview.tsx +16 -0
- package/src/components/atoms/count/count.styles.js +24 -0
- package/src/theme/provider/parent.theme.ts +18 -0
package/App.tsx
CHANGED
|
@@ -75,6 +75,7 @@ import {LinePreview} from './src/components/atoms/line/line.preview';
|
|
|
75
75
|
import {JournalEntryPreview} from './src/components/organisms/journal-entry/journal-entry.preview';
|
|
76
76
|
import { TimetableEditPreview } from './src/components/organisms/timetable-edit/timetable-edit.preview';
|
|
77
77
|
import { ContextLabelPreview } from './src/components/molecules/context-label/context-label.preview';
|
|
78
|
+
import { CountPreview } from './src/components/atoms/count/count.preview';
|
|
78
79
|
|
|
79
80
|
import {
|
|
80
81
|
SafeAreaProvider,
|
|
@@ -133,6 +134,10 @@ const HomeScreen = ({navigation}: {navigation: any}) => {
|
|
|
133
134
|
title="Context Label"
|
|
134
135
|
onPress={() => navigation.push('context-label')}
|
|
135
136
|
/>
|
|
137
|
+
<ReactBtn
|
|
138
|
+
title="Count"
|
|
139
|
+
onPress={() => navigation.push('count')}
|
|
140
|
+
/>
|
|
136
141
|
<ReactBtn
|
|
137
142
|
title="Date Input"
|
|
138
143
|
onPress={() => navigation.push('date-input')}
|
|
@@ -355,6 +360,9 @@ function App() {
|
|
|
355
360
|
<Stack.Screen name="context-label">
|
|
356
361
|
{() => <ContextLabelPreview />}
|
|
357
362
|
</Stack.Screen>
|
|
363
|
+
<Stack.Screen name="count">
|
|
364
|
+
{() => <CountPreview />}
|
|
365
|
+
</Stack.Screen>
|
|
358
366
|
<Stack.Screen name="date-input">
|
|
359
367
|
{() => <DateInputPreview />}
|
|
360
368
|
</Stack.Screen>
|
package/index.tsx
CHANGED
|
@@ -78,6 +78,7 @@ import {Line} from './src/components/atoms/line/line.component';
|
|
|
78
78
|
import {JournalEntry} from './src/components/organisms/journal-entry/journal-entry.component';
|
|
79
79
|
import {TimetableEdit} from './src/components/organisms/timetable-edit/timetable-edit.component';
|
|
80
80
|
import { ContextLabel } from './src/components/molecules/context-label/context-label.component';
|
|
81
|
+
import { Count } from './src/components/atoms/count/count.component';
|
|
81
82
|
|
|
82
83
|
// Exports of enums
|
|
83
84
|
import {BubbleAlignment} from './src/types/bubble-alignment.enum';
|
|
@@ -175,5 +176,6 @@ export {
|
|
|
175
176
|
CreateResponsiveStyle,
|
|
176
177
|
Scale,
|
|
177
178
|
TimetableEdit,
|
|
178
|
-
ContextLabel
|
|
179
|
+
ContextLabel,
|
|
180
|
+
Count
|
|
179
181
|
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import {useContext} from 'react';
|
|
4
|
+
import {ThemeCtx} from '../../../context/theme.context';
|
|
5
|
+
import { Stylesheet } from "./count.styles";
|
|
6
|
+
import { Paragraph } from "../paragraph-components";
|
|
7
|
+
|
|
8
|
+
interface CountProps {
|
|
9
|
+
count: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const Count = ({
|
|
13
|
+
count,
|
|
14
|
+
}: CountProps) => {
|
|
15
|
+
const context = useContext(ThemeCtx);
|
|
16
|
+
const styles = Stylesheet(context);
|
|
17
|
+
return <View style={styles.container}>
|
|
18
|
+
<Paragraph addStyle={styles.text}>{count}</Paragraph>
|
|
19
|
+
</View>;
|
|
20
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {View} from 'react-native';
|
|
2
|
+
import {useContext} from 'react';
|
|
3
|
+
import {ThemeCtx} from '../../../context/theme.context';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { Count } from './count.component';
|
|
6
|
+
|
|
7
|
+
export const CountPreview = () => {
|
|
8
|
+
const context = useContext(ThemeCtx);
|
|
9
|
+
return (
|
|
10
|
+
<View style={{alignItems: 'center', gap: 8}}>
|
|
11
|
+
<Count count={2} />
|
|
12
|
+
<Count count={99} />
|
|
13
|
+
<Count count={999999} />
|
|
14
|
+
</View>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
import { Scale } from '../../../theme/scale';
|
|
3
|
+
|
|
4
|
+
export const Stylesheet = (context) =>
|
|
5
|
+
StyleSheet.create({
|
|
6
|
+
container: {
|
|
7
|
+
borderWidth: 1,
|
|
8
|
+
borderColor: context.colors.main['1'],
|
|
9
|
+
borderRadius: 20,
|
|
10
|
+
paddingVertical: Scale.xs,
|
|
11
|
+
paddingHorizontal: Scale.m,
|
|
12
|
+
minWidth: Scale.xxxl,
|
|
13
|
+
color: context.colors.main['2'],
|
|
14
|
+
display: 'flex',
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
justifyContent: 'center',
|
|
17
|
+
flex: 0,
|
|
18
|
+
backgroundColor: context.colors.ui.white
|
|
19
|
+
},
|
|
20
|
+
text: {
|
|
21
|
+
width: 'auto',
|
|
22
|
+
fontSize: Scale.m
|
|
23
|
+
}
|
|
24
|
+
});
|
|
@@ -18,6 +18,24 @@ export const ParentTheme = {
|
|
|
18
18
|
1: Colors.primary[1],
|
|
19
19
|
0: Colors.primary[0],
|
|
20
20
|
},
|
|
21
|
+
state: {
|
|
22
|
+
unplanned: {
|
|
23
|
+
default: Colors.secondary['2'],
|
|
24
|
+
dark: Colors.secondary['0']
|
|
25
|
+
},
|
|
26
|
+
expected: {
|
|
27
|
+
default: Colors.ui.warning.default,
|
|
28
|
+
dark: Colors.ui.warning.dark
|
|
29
|
+
},
|
|
30
|
+
in: {
|
|
31
|
+
default: Colors.primary['4'],
|
|
32
|
+
dark: Colors.primary['2']
|
|
33
|
+
},
|
|
34
|
+
out: {
|
|
35
|
+
default: Colors.ui.success.default,
|
|
36
|
+
dark: Colors.ui.success.dark,
|
|
37
|
+
}
|
|
38
|
+
},
|
|
21
39
|
ui: {
|
|
22
40
|
black: Colors.ui.black,
|
|
23
41
|
white: Colors.ui.white,
|