Skip to content

Commit e5aa50a

Browse files
committed
feat(card): add 'none' option for padding in card components
Allow card components to specify 'none' as padding value to remove padding completely. This provides more flexibility in card layout customization.
1 parent 7fedcd2 commit e5aa50a

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

  • libs/rnc-theme/src/lib/components/ui/card

libs/rnc-theme/src/lib/components/ui/card/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ type CardProps = BaseCardProps & React.ComponentPropsWithoutRef<typeof View>;
2828
type CardContentProps = React.ComponentPropsWithoutRef<typeof View> & {
2929
children?: React.ReactNode;
3030
style?: ViewStyle;
31-
padding?: keyof Theme['spacing'];
31+
padding?: keyof Theme['spacing'] | 'none';
3232
};
3333

3434
type CardFooterProps = React.ComponentPropsWithoutRef<typeof View> & {
3535
children?: React.ReactNode;
3636
style?: ViewStyle;
37-
padding?: keyof Theme['spacing'];
37+
padding?: keyof Theme['spacing'] | 'none';
3838
showBorder?: boolean;
3939
justify?: ViewStyle['justifyContent'];
4040
};
@@ -46,7 +46,7 @@ type CardHeaderProps = React.ComponentPropsWithoutRef<typeof View> & {
4646
style?: ViewStyle;
4747
titleStyle?: TextStyle;
4848
subtitleStyle?: TextStyle;
49-
padding?: keyof Theme['spacing'];
49+
padding?: keyof Theme['spacing'] | 'none';
5050
titleVariant?: keyof Theme['typography'];
5151
subtitleVariant?: keyof Theme['typography'];
5252
borderBottom?: boolean;
@@ -234,7 +234,7 @@ const CardContent = forwardRef<
234234
ref={ref}
235235
style={[
236236
{
237-
padding: theme.spacing[padding],
237+
padding: padding === 'none' ? 0 : theme.spacing[padding],
238238
},
239239
style,
240240
]}
@@ -264,7 +264,7 @@ const CardFooter = forwardRef<React.ComponentRef<typeof View>, CardFooterProps>(
264264
ref={ref}
265265
style={[
266266
{
267-
padding: theme.spacing[padding],
267+
padding: padding === 'none' ? 0 : theme.spacing[padding],
268268
borderTopWidth: showBorder ? 1 : 0,
269269
borderTopColor: theme.colors.border,
270270
flexDirection: 'row',
@@ -335,7 +335,7 @@ const CardHeader = forwardRef<React.ComponentRef<typeof View>, CardHeaderProps>(
335335
ref={ref}
336336
style={[
337337
{
338-
padding: theme.spacing[padding],
338+
padding: padding === 'none' ? 0 : theme.spacing[padding],
339339
borderBottomWidth: borderBottom ? 1 : 0,
340340
borderBottomColor: theme.colors.border,
341341
},

0 commit comments

Comments
 (0)