Skip to content

Commit

Permalink
fix: move Accordion padding css
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Wallace authored and artmsilva committed Oct 19, 2022
1 parent 44c386c commit 9239cb6
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions ui/accordion/src/AccordionContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const easeInOutExpo = `cubic-bezier(0.87, 0, 0.13, 1)`;

const AnimatedContent = styled(AccordionPrimitive.Content, {
overflow: "hidden",
color: theme.colors.primary,
'&[data-state="open"]': {
animation: `${slideDown} ${theme.transitions.normal} ${easeInOutExpo}`,
},
Expand All @@ -27,7 +28,6 @@ const AnimatedContent = styled(AccordionPrimitive.Content, {
});

const ContentContainer = styled("div", {
color: theme.colors.primary,
paddingBottom: theme.space[150],
paddingRight: theme.space[150],
});
Expand All @@ -42,10 +42,27 @@ export interface AccordionContentInterface extends CombinedProps {
export const AccordionContent = React.forwardRef<
HTMLDivElement,
AccordionContentInterface
>(({ children, ...props }: AccordionContentInterface, ref) => (
<AnimatedContent {...props} ref={ref}>
<ContentContainer>{children}</ContentContainer>
</AnimatedContent>
));
>(({ children, ...props }: AccordionContentInterface, ref) => {
const {
padding = "",
paddingTop = "",
paddingBottom = "",
paddingLeft = "",
paddingRight = "",
...restOfCss
} = props.css ? props.css : {};

const otherProps = { ...props, css: { ...restOfCss } };

return (
<AnimatedContent {...otherProps} ref={ref}>
<ContentContainer
css={{ padding, paddingTop, paddingBottom, paddingLeft, paddingRight }}
>
{children}
</ContentContainer>
</AnimatedContent>
);
});

AccordionContent.displayName = "AccordionContent";

2 comments on commit 9239cb6

@vercel
Copy link

@vercel vercel bot commented on 9239cb6 Oct 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

wpds-ui-kit – ./build.washingtonpost.com

wpds-ui-kit-git-main.preview.now.washingtonpost.com
wpds-ui-kit.preview.now.washingtonpost.com
build.washingtonpost.com

@vercel
Copy link

@vercel vercel bot commented on 9239cb6 Oct 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

wpds-ui-kit-storybook – ./

wpds-ui-kit-storybook-git-main.preview.now.washingtonpost.com
wpds-ui-kit-storybook.preview.now.washingtonpost.com

Please sign in to comment.