From 2d80844b4ea68c5f9cd7c8c431198832b8a29beb Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Tue, 16 Jan 2024 15:45:43 -0600 Subject: [PATCH] Icons --- .../arrowTopRight_stoke2_corner0_rounded.svg | 1 + .../icons/globe_stroke2_corner0_rounded.svg | 1 + src/components/icons/ArrowTopRight.tsx | 27 ++++++++++++++++ src/components/icons/Globe.tsx | 27 ++++++++++++++++ src/components/icons/TEMPLATE.tsx | 27 ++++++++++++++++ src/components/icons/common.ts | 32 +++++++++++++++++++ src/view/screens/Storybook/Icons.tsx | 32 +++++++++++++++++++ src/view/screens/Storybook/index.tsx | 4 ++- 8 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 assets/icons/arrowTopRight_stoke2_corner0_rounded.svg create mode 100644 assets/icons/globe_stroke2_corner0_rounded.svg create mode 100644 src/components/icons/ArrowTopRight.tsx create mode 100644 src/components/icons/Globe.tsx create mode 100644 src/components/icons/TEMPLATE.tsx create mode 100644 src/components/icons/common.ts create mode 100644 src/view/screens/Storybook/Icons.tsx diff --git a/assets/icons/arrowTopRight_stoke2_corner0_rounded.svg b/assets/icons/arrowTopRight_stoke2_corner0_rounded.svg new file mode 100644 index 0000000000..554a7374ec --- /dev/null +++ b/assets/icons/arrowTopRight_stoke2_corner0_rounded.svg @@ -0,0 +1 @@ + diff --git a/assets/icons/globe_stroke2_corner0_rounded.svg b/assets/icons/globe_stroke2_corner0_rounded.svg new file mode 100644 index 0000000000..83cb88d136 --- /dev/null +++ b/assets/icons/globe_stroke2_corner0_rounded.svg @@ -0,0 +1 @@ + diff --git a/src/components/icons/ArrowTopRight.tsx b/src/components/icons/ArrowTopRight.tsx new file mode 100644 index 0000000000..ca29730203 --- /dev/null +++ b/src/components/icons/ArrowTopRight.tsx @@ -0,0 +1,27 @@ +import React from 'react' +import Svg, {Path} from 'react-native-svg' + +import {useCommonSVGProps, Props} from '#/components/icons/common' + +export const ArrowTopRight_Stroke2_Corner0_Rounded = React.forwardRef( + function LogoImpl(props: Props, ref) { + const {fill, size, style, ...rest} = useCommonSVGProps(props) + + return ( + + + + ) + }, +) diff --git a/src/components/icons/Globe.tsx b/src/components/icons/Globe.tsx new file mode 100644 index 0000000000..3801607ea3 --- /dev/null +++ b/src/components/icons/Globe.tsx @@ -0,0 +1,27 @@ +import React from 'react' +import Svg, {Path} from 'react-native-svg' + +import {useCommonSVGProps, Props} from '#/components/icons/common' + +export const Globe_Stroke2_Corner0_Rounded = React.forwardRef(function LogoImpl( + props: Props, + ref, +) { + const {fill, size, style, ...rest} = useCommonSVGProps(props) + + return ( + + + + ) +}) diff --git a/src/components/icons/TEMPLATE.tsx b/src/components/icons/TEMPLATE.tsx new file mode 100644 index 0000000000..c3e53336bd --- /dev/null +++ b/src/components/icons/TEMPLATE.tsx @@ -0,0 +1,27 @@ +import React from 'react' +import Svg, {Path} from 'react-native-svg' + +import {useCommonSVGProps, Props} from '#/components/icons/common' + +export const IconTemplate_Stroke2_Corner0_Rounded = React.forwardRef( + function LogoImpl(props: Props, ref) { + const {fill, size, style, ...rest} = useCommonSVGProps(props) + + return ( + + + + ) + }, +) diff --git a/src/components/icons/common.ts b/src/components/icons/common.ts new file mode 100644 index 0000000000..2eaafb2cd1 --- /dev/null +++ b/src/components/icons/common.ts @@ -0,0 +1,32 @@ +import {StyleSheet, TextProps} from 'react-native' +import type {SvgProps, PathProps} from 'react-native-svg' + +import {tokens} from '#/alf' + +export type Props = { + fill?: PathProps['fill'] + style?: TextProps['style'] + size?: keyof typeof sizes +} & Omit + +export const sizes = { + xs: 12, + sm: 16, + md: 20, + lg: 24, + xl: 28, +} + +export function useCommonSVGProps(props: Props) { + const {fill, size, ...rest} = props + const style = StyleSheet.flatten(rest.style) + const _fill = fill || style?.color || tokens.color.blue_500 + const _size = Number(size ? sizes[size] : rest.width || sizes.md) + + return { + fill: _fill, + size: _size, + style, + ...rest, + } +} diff --git a/src/view/screens/Storybook/Icons.tsx b/src/view/screens/Storybook/Icons.tsx new file mode 100644 index 0000000000..c3c41ce7e9 --- /dev/null +++ b/src/view/screens/Storybook/Icons.tsx @@ -0,0 +1,32 @@ +import React from 'react' +import {View} from 'react-native' + +import {atoms as a, useTheme} from '#/alf' +import {H1} from '#/components/Typography' +import {Globe_Stroke2_Corner0_Rounded as Globe} from '#/components/icons/Globe' +import {ArrowTopRight_Stroke2_Corner0_Rounded as ArrowTopRight} from '#/components/icons/ArrowTopRight' + +export function Icons() { + const t = useTheme() + return ( + +

Icons

+ + + + + + + + + + + + + + + + +
+ ) +} diff --git a/src/view/screens/Storybook/index.tsx b/src/view/screens/Storybook/index.tsx index fa07cd9d79..9f627ad2c2 100644 --- a/src/view/screens/Storybook/index.tsx +++ b/src/view/screens/Storybook/index.tsx @@ -15,6 +15,7 @@ import {Forms} from './Forms' import {Dialogs} from './Dialogs' import {Breakpoints} from './Breakpoints' import {Shadows} from './Shadows' +import {Icons} from './Icons' export function Storybook() { const t = useTheme() @@ -53,7 +54,6 @@ export function Storybook() { Dark - @@ -69,8 +69,10 @@ export function Storybook() { + +