From d3eb2886403e34266de19ad3fbeafbfd3bdc4d67 Mon Sep 17 00:00:00 2001 From: "Mauro E. Bender" Date: Wed, 28 Sep 2022 13:55:54 +0200 Subject: [PATCH] Improve example apps examples --- example/src/App.tsx | 21 +++ example/src/components/BoxExamples.tsx | 8 +- example/src/components/ButtonExamples.tsx | 13 +- example/src/components/CheckboxExamples.tsx | 16 +- .../src/components/FormControlExamples.tsx | 12 +- example/src/components/IconButtonExamples.tsx | 4 +- example/src/components/IconExamples.tsx | 176 ++++++++--------- example/src/components/PaletteColorGrid.tsx | 67 +++++++ example/src/components/RadioExamples.tsx | 16 +- example/src/components/TextExamples.tsx | 25 +-- example/src/components/TextInputExamples.tsx | 8 +- web_example/src/App.tsx | 39 +++- web_example/src/components/BoxExamples.tsx | 8 +- web_example/src/components/ButtonExamples.tsx | 10 +- .../src/components/CheckboxExamples.tsx | 18 +- .../src/components/FormControlExamples.tsx | 16 +- .../src/components/IconButtonExamples.tsx | 33 ++-- web_example/src/components/IconExamples.tsx | 178 +++++++++--------- .../src/components/PaletteColorGrid.tsx | 67 +++++++ web_example/src/components/RadioExamples.tsx | 16 +- web_example/src/components/TextExamples.tsx | 23 ++- .../src/components/TextInputExamples.tsx | 8 +- 22 files changed, 477 insertions(+), 305 deletions(-) create mode 100644 example/src/components/PaletteColorGrid.tsx create mode 100644 web_example/src/components/PaletteColorGrid.tsx diff --git a/example/src/App.tsx b/example/src/App.tsx index 197b6ad..86c3360 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -14,6 +14,7 @@ import CheckboxExamples from './components/CheckboxExamples'; import RadioExamples from './components/RadioExamples'; import FormControlExamples from './components/FormControlExamples'; import TextInputExamples from './components/TextInputExamples'; +import PaletteColorGrid from './components/PaletteColorGrid'; const styles = StyleSheet.create( { container: { @@ -46,6 +47,25 @@ const customTheme = extendThemeConfig( { } }, components: { + Text: { + variants: { + 'headline': { + font: 'Epilogue', + fontSize: '3xl', + fontWeight: 'bold', + lineHeight: '3xl', + letterSpacing: 'md', + bg: 'secondary.100' + }, + 'subtitle': { + font: 'Epilogue', + fontSize: 'md', + lineHeight: 'md', + letterSpacing: 'md', + color: 'primary.800' + } + } + }, Button: { variants: { custom: { @@ -84,6 +104,7 @@ export default function App() { + diff --git a/example/src/components/BoxExamples.tsx b/example/src/components/BoxExamples.tsx index 21d6515..b80b3a6 100644 --- a/example/src/components/BoxExamples.tsx +++ b/example/src/components/BoxExamples.tsx @@ -27,9 +27,9 @@ const styles = StyleSheet.create( { const BoxExamples = () => ( - Box Component + Box Component - Border radius + Border radius @@ -54,7 +54,7 @@ const BoxExamples = () => ( - Padding + Padding @@ -68,7 +68,7 @@ const BoxExamples = () => ( - Margin + Margin diff --git a/example/src/components/ButtonExamples.tsx b/example/src/components/ButtonExamples.tsx index f477aaf..88166da 100644 --- a/example/src/components/ButtonExamples.tsx +++ b/example/src/components/ButtonExamples.tsx @@ -26,15 +26,16 @@ const onButtonPressed = () => Alert.alert( 'Pressed!' ); const ButtonExamples = () => ( - Button Component + Button Component - Variants + Variants + - Icons + Icons - Disabled + Disabled + + - Horizontal group + Horizontal group diff --git a/example/src/components/CheckboxExamples.tsx b/example/src/components/CheckboxExamples.tsx index cb617c1..6fffa44 100644 --- a/example/src/components/CheckboxExamples.tsx +++ b/example/src/components/CheckboxExamples.tsx @@ -43,9 +43,9 @@ const CheckboxExamples = () => { return ( - Checkbox Component + Checkbox Component - Enabled + Enabled @@ -55,7 +55,7 @@ const CheckboxExamples = () => { - Disabled + Disabled @@ -65,7 +65,7 @@ const CheckboxExamples = () => { - On Change + On Change @@ -74,7 +74,7 @@ const CheckboxExamples = () => { - With Label + With Label @@ -87,10 +87,10 @@ const CheckboxExamples = () => { - Checkbox Group Component + Checkbox Group Component - Select multiple options + Select multiple options { - Disabled + Disabled ( - FormControl Component + FormControl Component - With label + With label ( - Not required + Not required ( - With hint + With hint ( - Without label + Without label ( - With error + With error Alert.alert( 'Pressed!' ); const IconButtonExamples = () => ( - IconButton Component + IconButton Component + - ); diff --git a/example/src/components/IconExamples.tsx b/example/src/components/IconExamples.tsx index 81cd630..aa26052 100644 --- a/example/src/components/IconExamples.tsx +++ b/example/src/components/IconExamples.tsx @@ -37,140 +37,140 @@ const styles = StyleSheet.create( { const IconExamples = () => ( - Icon Component + Icon Component - Icon sets + Icon sets AntDesign - - - - - - - + + + + + + + Entypo - - - - - - - + + + + + + + EvilIcons - - - - - - - + + + + + + + Feather - - - - - - - + + + + + + + Fontawesome - - - - - - - + + + + + + + Fontisto - - - - - - - + + + + + + + Foundation - - - - - - - + + + + + + + Ionicons - - - - - - - + + + + + + + MaterialCommunityIcons - - - - - - - + + + + + + + Octicons - - - - - - - + + + + + + + SimpleLineIcons - - - - - - - + + + + + + + Zocial - - - - - - - + + + + + + + - Sizes + Sizes + - ); diff --git a/example/src/components/PaletteColorGrid.tsx b/example/src/components/PaletteColorGrid.tsx new file mode 100644 index 0000000..9bad376 --- /dev/null +++ b/example/src/components/PaletteColorGrid.tsx @@ -0,0 +1,67 @@ +import * as React from 'react'; + +import { StyleSheet, View } from 'react-native'; +import { + Box, Text, VStack, HStack +} from '@amalgama/react-native-ui-kit'; + +const styles = StyleSheet.create( { + container: { + width: '100%', + marginBottom: 20 + }, + separator: { + height: 1, + minWidth: '100%', + marginTop: 2, + marginBottom: 6, + backgroundColor: 'black' + }, + vspace: { + height: 10, + minWidth: '100%' + } +} ); + +const PaletteColorGrid = () => { + const colors = [ + 'primary', 'secondary', 'neutral', 'error', 'warning', + 'success', 'information', 'accent' + ]; + const range = [ 50, 100, 200, 300, 400, 500, 600, 700, 800, 900 ]; + + return ( + + Palette + + + {colors.map( ( color => ( + + {color} + + {range.map( tone => ( + + 400 ? 'white' : 'black'} + fontSize="xs" + textAlign='center' + > + {tone} + + + ) )} + + + ) ) )} + + + ); +}; + +export default PaletteColorGrid; diff --git a/example/src/components/RadioExamples.tsx b/example/src/components/RadioExamples.tsx index 126181f..0a7b4f5 100644 --- a/example/src/components/RadioExamples.tsx +++ b/example/src/components/RadioExamples.tsx @@ -30,9 +30,9 @@ const RadioExamples = () => { return ( - Radio Component + Radio Component - Enabled + Enabled @@ -41,7 +41,7 @@ const RadioExamples = () => { - Disabled + Disabled @@ -50,7 +50,7 @@ const RadioExamples = () => { - On press + On press @@ -59,7 +59,7 @@ const RadioExamples = () => { - With Label + With Label @@ -76,10 +76,10 @@ const RadioExamples = () => { - Radio Group Component + Radio Group Component - Select one option + Select one option { - Disabled + Disabled ( - Text Component + Text Component - Variants + Variants Headline 1 Headline 2 Headline 3 - Subtitle 1 - Subtitle 2 - Subtitle 3 - Body text - Body text 2 + Subtitle + Body + Body special + Body italic Links - Small text - Small bold text - Caption text - Caption bold text + Small + Small bold + Small link + Extra small + Extra small bold + Extra small link - Free props + Free props Text Text! diff --git a/example/src/components/TextInputExamples.tsx b/example/src/components/TextInputExamples.tsx index 0030a08..cf6c78b 100644 --- a/example/src/components/TextInputExamples.tsx +++ b/example/src/components/TextInputExamples.tsx @@ -22,9 +22,9 @@ const styles = { const TextInputExamples = () => ( - Text Input Component + Text Input Component - Enabled + Enabled @@ -33,7 +33,7 @@ const TextInputExamples = () => ( - Disabled + Disabled @@ -42,7 +42,7 @@ const TextInputExamples = () => ( - Error + Error diff --git a/web_example/src/App.tsx b/web_example/src/App.tsx index 7f159de..46e8113 100644 --- a/web_example/src/App.tsx +++ b/web_example/src/App.tsx @@ -16,6 +16,7 @@ import CheckboxExamples from './components/CheckboxExamples'; import RadioExamples from './components/RadioExamples'; import FormControlExamples from './components/FormControlExamples'; import TextInputExamples from './components/TextInputExamples'; +import PaletteColorGrid from './components/PaletteColorGrid'; const customTheme = extendThemeConfig( { palette: { @@ -50,19 +51,38 @@ const customTheme = extendThemeConfig( { 900: { normal: 'Epilogue', italic: 'Epilogue' } }, 'Inter': { - 100: { normal: 'Inter' }, - 200: { normal: 'Inter' }, - 300: { normal: 'Inter' }, - 400: { normal: 'Inter' }, - 500: { normal: 'Inter' }, - 600: { normal: 'Inter' }, - 700: { normal: 'Inter' }, - 800: { normal: 'Inter' }, - 900: { normal: 'Inter' } + 100: { normal: 'Inter', italic: 'Inter' }, + 200: { normal: 'Inter', italic: 'Inter' }, + 300: { normal: 'Inter', italic: 'Inter' }, + 400: { normal: 'Inter', italic: 'Inter' }, + 500: { normal: 'Inter', italic: 'Inter' }, + 600: { normal: 'Inter', italic: 'Inter' }, + 700: { normal: 'Inter', italic: 'Inter' }, + 800: { normal: 'Inter', italic: 'Inter' }, + 900: { normal: 'Inter', italic: 'Inter' } } } }, components: { + Text: { + variants: { + 'headline': { + font: 'Epilogue', + fontSize: '3xl', + fontWeight: 'bold', + lineHeight: '3xl', + letterSpacing: 'md', + bg: 'secondary.100' + }, + 'subtitle': { + font: 'Epilogue', + fontSize: 'md', + lineHeight: 'md', + letterSpacing: 'md', + color: 'primary.800' + } + } + }, Button: { variants: { custom: { @@ -93,6 +113,7 @@ export default function App() { + diff --git a/web_example/src/components/BoxExamples.tsx b/web_example/src/components/BoxExamples.tsx index 21d6515..b80b3a6 100644 --- a/web_example/src/components/BoxExamples.tsx +++ b/web_example/src/components/BoxExamples.tsx @@ -27,9 +27,9 @@ const styles = StyleSheet.create( { const BoxExamples = () => ( - Box Component + Box Component - Border radius + Border radius @@ -54,7 +54,7 @@ const BoxExamples = () => ( - Padding + Padding @@ -68,7 +68,7 @@ const BoxExamples = () => ( - Margin + Margin diff --git a/web_example/src/components/ButtonExamples.tsx b/web_example/src/components/ButtonExamples.tsx index aab9715..88cafa0 100644 --- a/web_example/src/components/ButtonExamples.tsx +++ b/web_example/src/components/ButtonExamples.tsx @@ -26,15 +26,15 @@ const onButtonPressed = () => window.alert( 'Pressed!' ); const ButtonExamples = () => ( - Button Component + Button Component - Variants + Variants - Icons + Icons - Disabled + Disabled @@ -79,7 +79,7 @@ const ButtonExamples = () => ( > Primary with custom disabled bg - Horizontal group + Horizontal group diff --git a/web_example/src/components/CheckboxExamples.tsx b/web_example/src/components/CheckboxExamples.tsx index 0c72e49..0436cd9 100644 --- a/web_example/src/components/CheckboxExamples.tsx +++ b/web_example/src/components/CheckboxExamples.tsx @@ -42,9 +42,9 @@ const CheckboxExamples = () => { return ( - Checkbox Component + Checkbox Component - Enabled + Enabled @@ -54,7 +54,7 @@ const CheckboxExamples = () => { - Disabled + Disabled @@ -64,7 +64,7 @@ const CheckboxExamples = () => { - On Focus + On Focus @@ -76,7 +76,7 @@ const CheckboxExamples = () => { - On Change + On Change @@ -87,7 +87,7 @@ const CheckboxExamples = () => { - With Label + With Label @@ -106,10 +106,10 @@ const CheckboxExamples = () => { - Checkbox Group Component + Checkbox Group Component - Select multiple options + Select multiple options { - Disabled + Disabled ( - FormControl Component + FormControl Component - With label + With label ( - Not required + Not required ( - With hint + With hint ( - Without label + Without label ( - With error + With error ( - With Checkboxes + With Checkboxes ( - With Radios + With Radios window.alert( 'You pressed the red heart' ); -const onPressBlack = () => window.alert( 'You pressed the black heart' ); +const onPressed = () => Alert.alert( 'Pressed!' ); const IconButtonExamples = () => ( - IconButton Component - - - + IconButton Component + + + + + + + + + ); diff --git a/web_example/src/components/IconExamples.tsx b/web_example/src/components/IconExamples.tsx index 81cd630..84433f0 100644 --- a/web_example/src/components/IconExamples.tsx +++ b/web_example/src/components/IconExamples.tsx @@ -37,140 +37,140 @@ const styles = StyleSheet.create( { const IconExamples = () => ( - Icon Component + Icon Component - Icon sets + Icon sets AntDesign - - - - - - - + + + + + + + Entypo - - - - - - - + + + + + + + EvilIcons - - - - - - - + + + + + + + Feather - - - - - - - + + + + + + + Fontawesome - - - - - - - + + + + + + + Fontisto - - - - - - - + + + + + + + Foundation - - - - - - - + + + + + + + Ionicons - - - - - - - + + + + + + + MaterialCommunityIcons - - - - - - - + + + + + + + Octicons - - - - - - - + + + + + + + SimpleLineIcons - - - - - - - + + + + + + + Zocial - - - - - - - + + + + + + + - Sizes + Sizes + - + - ); diff --git a/web_example/src/components/PaletteColorGrid.tsx b/web_example/src/components/PaletteColorGrid.tsx new file mode 100644 index 0000000..9bad376 --- /dev/null +++ b/web_example/src/components/PaletteColorGrid.tsx @@ -0,0 +1,67 @@ +import * as React from 'react'; + +import { StyleSheet, View } from 'react-native'; +import { + Box, Text, VStack, HStack +} from '@amalgama/react-native-ui-kit'; + +const styles = StyleSheet.create( { + container: { + width: '100%', + marginBottom: 20 + }, + separator: { + height: 1, + minWidth: '100%', + marginTop: 2, + marginBottom: 6, + backgroundColor: 'black' + }, + vspace: { + height: 10, + minWidth: '100%' + } +} ); + +const PaletteColorGrid = () => { + const colors = [ + 'primary', 'secondary', 'neutral', 'error', 'warning', + 'success', 'information', 'accent' + ]; + const range = [ 50, 100, 200, 300, 400, 500, 600, 700, 800, 900 ]; + + return ( + + Palette + + + {colors.map( ( color => ( + + {color} + + {range.map( tone => ( + + 400 ? 'white' : 'black'} + fontSize="xs" + textAlign='center' + > + {tone} + + + ) )} + + + ) ) )} + + + ); +}; + +export default PaletteColorGrid; diff --git a/web_example/src/components/RadioExamples.tsx b/web_example/src/components/RadioExamples.tsx index 67d0bdc..3da6144 100644 --- a/web_example/src/components/RadioExamples.tsx +++ b/web_example/src/components/RadioExamples.tsx @@ -30,9 +30,9 @@ const RadioExamples = () => { return ( - Radio Component + Radio Component - Enabled + Enabled @@ -41,7 +41,7 @@ const RadioExamples = () => { - Disabled + Disabled @@ -50,7 +50,7 @@ const RadioExamples = () => { - On press + On press @@ -59,7 +59,7 @@ const RadioExamples = () => { - With Label + With Label @@ -76,10 +76,10 @@ const RadioExamples = () => { - Radio Group Component + Radio Group Component - Select multiple options + Select multiple options { - Disabled + Disabled ( - Text Component + Text Component - Variants + Variants Headline 1 Headline 2 Headline 3 - Subtitle 1 - Subtitle 2 - Subtitle 3 - Body text - Body text 2 + Subtitle + Body + Body special + Body italic Links - Small text - Small bold text - Caption text - Caption bold text + Small + Small bold + Extra small + Extra small bold - Free props + Free props Text Text! diff --git a/web_example/src/components/TextInputExamples.tsx b/web_example/src/components/TextInputExamples.tsx index ccfadc0..e726791 100644 --- a/web_example/src/components/TextInputExamples.tsx +++ b/web_example/src/components/TextInputExamples.tsx @@ -21,9 +21,9 @@ const styles = { const TextInputExamples = () => ( - Text Input Component + Text Input Component - Enabled + Enabled @@ -33,7 +33,7 @@ const TextInputExamples = () => ( - Disabled + Disabled @@ -43,7 +43,7 @@ const TextInputExamples = () => ( - Error + Error