mirror of
https://github.com/morten-olsen/bob-the-algorithm.git
synced 2026-02-08 00:46:25 +01:00
v3
This commit is contained in:
29
src/ui/components/base/icon/index.tsx
Normal file
29
src/ui/components/base/icon/index.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import React from 'react';
|
||||
import { Feather, } from '@expo/vector-icons';
|
||||
import { useTheme } from 'styled-components/native';
|
||||
import { Theme } from '#/ui/theme';
|
||||
|
||||
type IconNames = keyof typeof Feather.glyphMap;
|
||||
type Props = {
|
||||
size?: number;
|
||||
color?: keyof Theme['colors'];
|
||||
name: IconNames;
|
||||
}
|
||||
|
||||
function Icon({
|
||||
size,
|
||||
color,
|
||||
name,
|
||||
}: Props) {
|
||||
const theme = useTheme();
|
||||
return (
|
||||
<Feather
|
||||
name={name}
|
||||
color={color ? theme.colors[color] : theme.colors.icon}
|
||||
size={size ?? theme.sizes.icons}
|
||||
/>
|
||||
)
|
||||
};
|
||||
|
||||
export type { IconNames };
|
||||
export { Icon };
|
||||
Reference in New Issue
Block a user