Skip to content

Commit

Permalink
Add style prop on BorderedIcon component
Browse files Browse the repository at this point in the history
  • Loading branch information
zoontek committed Dec 6, 2023
1 parent a4af00f commit 846842b
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions packages/lake/src/components/BorderedIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StyleSheet } from "react-native";
import { colors, ColorVariants, Radii, radii } from "../constants/design";
import { StyleSheet, ViewProps } from "react-native";
import { ColorVariants, Radii, colors, radii } from "../constants/design";
import { Box } from "./Box";
import { Icon, IconName } from "./Icon";
import { SpacingValue } from "./Space";
Expand All @@ -14,36 +14,33 @@ const styles = StyleSheet.create({

type Props = {
name: IconName;
size?: number;
padding?: SpacingValue | 0;
color?: ColorVariants;
borderRadius?: Radii;
color?: ColorVariants;
padding?: SpacingValue | 0;
size?: number;
style?: ViewProps["style"];
};

export const BorderedIcon = ({
name,
size = 96,
padding = 0,
color = "current",
borderRadius = 8,
color = "current",
padding = 0,
size = 96,
style,
}: Props) => {
const iconSize = size - padding * 2;

const boxStyle = {
backgroundColor: colors[color][50],
borderColor: colors[color][100],
borderRadius: radii[borderRadius],
width: size,
height: size,
};

return (
<Box
alignItems="center"
justifyContent="center"
style={[
styles.base,
{
width: size,
height: size,
borderColor: colors[color][100],
backgroundColor: colors[color][50],
borderRadius: radii[borderRadius],
},
]}
>
<Box alignItems="center" justifyContent="center" style={[styles.base, boxStyle, style]}>
<Icon name={name} size={iconSize} color={colors[color][500]} />
</Box>
);
Expand Down

0 comments on commit 846842b

Please sign in to comment.