Skip to content

Commit

Permalink
Merge pull request #2508 from NDLANO/key-figure-spacing
Browse files Browse the repository at this point in the history
Fix key figure padding
  • Loading branch information
katrinewi authored Sep 26, 2024
2 parents 633bd1b + cd300af commit f030fd1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
24 changes: 15 additions & 9 deletions packages/ndla-ui/src/Grid/Grid.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,28 @@ export const GridKeyPerformanceStory: StoryFn<typeof Grid> = ({ ...args }) => {
const columns = args.columns === "2x2" ? 4 : parseInt(args.columns);
const items = new Array(columns).fill(0).map((_, idx) => {
const args = keyFigureArgs[idx % keyFigureArgs.length];
return <Plain key={idx} {...args} />;
return (
<div key={idx} data-type="grid-cell" data-parallax-cell="false">
<Plain key={idx} {...args} />
</div>
);
});
return <Grid {...args}>{items}</Grid>;
};

export const GridBlogPostStory: StoryFn<typeof Grid> = ({ ...args }) => {
const columns = args.columns === "2x2" ? 4 : parseInt(args.columns);
const items = new Array(columns).fill(
<BlogPostStory
metaImage={BlogPostStory.args?.metaImage!}
title={BlogPostStory.args?.title!}
size={"normal"}
headingLevel={BlogPostStory.args?.headingLevel}
url={BlogPostStory.args?.url!}
author={BlogPostStory.args?.author}
/>,
<div data-type="grid-cell" data-parallax-cell="false">
<BlogPostStory
metaImage={BlogPostStory.args?.metaImage!}
title={BlogPostStory.args?.title!}
size={"normal"}
headingLevel={BlogPostStory.args?.headingLevel}
url={BlogPostStory.args?.url!}
author={BlogPostStory.args?.author}
/>
</div>,
);
return <Grid {...args}>{items}</Grid>;
};
5 changes: 5 additions & 0 deletions packages/ndla-ui/src/KeyFigure/KeyFigure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ const ContentWrapper = styled("div", {
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
gap: "xsmall",

"&:not(:has(> img))": {
paddingBlock: "xxlarge",
},
},
});

Expand Down

0 comments on commit f030fd1

Please sign in to comment.