Skip to content

Commit

Permalink
finetune section card
Browse files Browse the repository at this point in the history
  • Loading branch information
sstraatemans committed Nov 27, 2024
1 parent 46c83df commit aa7014c
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import { MonoAdd } from '@kadena/kode-icons/system';
import type { Meta, StoryObj } from '@storybook/react';
import React from 'react';
import { Button, Stack } from './../../components';
import { ISectionCardProps, SectionCard } from './SectionCard';
import { ISectionCardBody, SectionCardBody } from './SectionCardBody';
import type { ISectionCardProps } from './SectionCard';
import { SectionCard } from './SectionCard';
import type { ISectionCardBodyProps } from './SectionCardBody';
import { SectionCardBody } from './SectionCardBody';
import { SectionCardContentBlock } from './SectionCardContentBlock';
import {
SectionCardHeader,
type ISectionCardHeaderProps,
} from './SectionCardHeader';
import type { ISectionCardHeaderProps } from './SectionCardHeader';
import { SectionCardHeader } from './SectionCardHeader';

interface IProps
extends ISectionCardHeaderProps,
ISectionCardProps,
ISectionCardBody {}
ISectionCardBodyProps {}

const meta: Meta<IProps> = {
title: 'Patterns/SectionCard',
Expand All @@ -40,9 +40,9 @@ const meta: Meta<IProps> = {
},
},
variant: {
options: ['horizontal', 'vertical'],
control: {
type: 'select',
options: ['horizontal', 'vertical'],
},
},
children: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { FC, PropsWithChildren } from 'react';
import React from 'react';
import { Stack } from './../../components';
import { ISectionCardProps } from './SectionCard';
import type { ISectionCardProps } from './SectionCard';
import { SectionCardBody } from './SectionCardBody';
import { SectionCardHeader } from './SectionCardHeader';
import { blockClass } from './style.css';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { FC, ReactElement } from 'react';
import React from 'react';
import { Heading, Stack, Text } from './../../components';
import { ISectionCardProps } from './SectionCard';
import { ISectionCardBody } from './SectionCardBody';
import { headerClass, headerDescriptionClass } from './style.css';
import type { ISectionCardProps } from './SectionCard';
import { actionsClass, headerClass, headerDescriptionClass } from './style.css';

export interface ISectionCardHeaderProps {
title: string;
Expand Down Expand Up @@ -32,7 +31,14 @@ export const SectionCardHeader: FC<ISectionCardHeaderProps> = ({
</Text>
</Stack>
)}
{actions && <Stack style={{ gridArea: 'actions' }}>{actions}</Stack>}
{actions && (
<Stack
className={actionsClass({ variant })}
style={{ gridArea: 'actions' }}
>
{actions}
</Stack>
)}
</Stack>
);
};
39 changes: 37 additions & 2 deletions packages/libs/kode-ui/src/patterns/SectionCard/style.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ export const headerClass = recipe({
},
}),
],
vertical: {},
vertical: {
ridTemplateColumns: `2fr 1fr`,
gridTemplateAreas: `
"header actions"
"description actions"
`,
},
},
},
});
Expand All @@ -61,6 +67,29 @@ export const cardClass = style([
}),
]);

export const actionsClass = recipe({
base: {
alignItems: 'flex-start',
},
variants: {
variant: {
horizontal: [
responsiveStyle({
xs: {
justifyContent: 'flex-end',
},
md: {
justifyContent: 'flex-start',
},
}),
],
vertical: {
justifyContent: 'flex-end',
},
},
},
});

export const blockClass = recipe({
base: {
display: 'grid!important',
Expand All @@ -86,7 +115,13 @@ export const blockClass = recipe({
}),
],

vertical: {},
vertical: {
gridTemplateColumns: `1fr`,
gridTemplateAreas: `
"header"
"body"
`,
},
},
},
});

0 comments on commit aa7014c

Please sign in to comment.