Skip to content

Commit

Permalink
added box props
Browse files Browse the repository at this point in the history
  • Loading branch information
LinKCoding committed Feb 25, 2025
1 parent 2ef51b3 commit a532ae5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions packages/gamut/src/Card/elements.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CheckerDense } from '@codecademy/gamut-patterns';
import { Background, Colors, styledOptions } from '@codecademy/gamut-styles';
import { Background, Colors } from '@codecademy/gamut-styles';
import styled from '@emotion/styled';
import { useState } from 'react';

Expand All @@ -23,8 +23,7 @@ export const DynamicCardWrapper = styled(Box)<CardWrapperProps>(
);

export const StaticCardWrapper = styled(
Background,
styledOptions
Background
)<CardWrapperProps>(cardVariants, shadowVariants, hoverState);

// const PatternWrapper = styled(Box)(patternHoverState);
Expand Down Expand Up @@ -74,11 +73,12 @@ export const CardWrapper: React.FC<CardWrapperProps> = ({
/>
)}
<SelectedWrapper
{...rest}
bg={variant !== 'default' ? (variant as Colors) : 'white'}
variant={variant}
shadow={shadow}
isInteractive={isInteractive}
{...rest}

>
{children}
</SelectedWrapper>
Expand Down
3 changes: 2 additions & 1 deletion packages/gamut/src/Card/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const cardVariants = variant({
defaultVariant: 'default',
base: {
border: 1,
borderRadius: 'md',
borderRadius: 'none',
p: 16,
color: 'text',
maxWidth: '100%',
Expand Down Expand Up @@ -50,6 +50,7 @@ export const shadowVariants = variant({

export const hoverState = states({
isInteractive: {
borderRadius: 'md',
'&:hover': {
transition: 'box-shadow 200ms ease',
boxShadow: `0px 0px ${theme.colors['shadow-primary']}`,
Expand Down
6 changes: 5 additions & 1 deletion packages/gamut/src/Card/types.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { PatternProps } from '@codecademy/gamut-patterns';
import { StyleProps } from '@codecademy/variance';
import { ComponentProps } from 'react';

import { Box } from '../Box';
import { WithChildrenProp } from '../utils';
import {
cardAnchorVariants,
Expand All @@ -18,10 +20,12 @@ export interface CardWrapperProps
isHovering?: boolean;
}

export interface CardProps extends CardWrapperProps {
export interface BaseCardProps extends CardWrapperProps {
href?: string;
onClick?: () => void;
}

export type CardProps = BaseCardProps & ComponentProps<typeof Box> ;

export type CardAnchorProps = StyleProps<typeof cardAnchorVariants> &
WithChildrenProp;

0 comments on commit a532ae5

Please sign in to comment.