Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/card component #63

Merged
merged 53 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
3eab672
docs: Added README to card component
Marwaxhello May 22, 2024
2a8eb6e
build: Card added to stories
Marwaxhello May 22, 2024
e92b5f3
style: styling
Marwaxhello May 23, 2024
6d97847
build: added to stories
Marwaxhello May 23, 2024
86a392c
build: added react card to stories
Marwaxhello May 23, 2024
70254ac
build: card component
Marwaxhello May 23, 2024
bccb54f
build: index card component
Marwaxhello May 28, 2024
3830cc1
build: card index component
Marwaxhello May 28, 2024
38ca2fe
refactor: removed file
Marwaxhello May 28, 2024
83f1019
build: Added content
Marwaxhello May 30, 2024
3972743
feat: added card export
Marwaxhello May 30, 2024
662773c
feat: added component card tokens
Marwaxhello May 30, 2024
54a3181
build: added cardgroup component
Marwaxhello May 31, 2024
4fe0905
refactor: removed children content
Marwaxhello May 31, 2024
505a9bd
refactor: removed unnecessary tokens
Marwaxhello May 31, 2024
48bffec
refactor: typos fix
Marwaxhello Jun 3, 2024
af5eb44
refactor: deleted file
Marwaxhello Jun 3, 2024
ec9c029
feat: added card group
Marwaxhello Jun 3, 2024
01cb568
feat: added card group stories
Marwaxhello Jun 3, 2024
7006ef2
build: card content
Marwaxhello Jun 3, 2024
991c3da
feat: added cardgroup to index.ts
Marwaxhello Jun 3, 2024
466ed36
feat: added react cardgroup stories
Marwaxhello Jun 3, 2024
f2709d0
feat: added tokens
Marwaxhello Jun 3, 2024
8b6b8f2
style: styling with tokens
Marwaxhello Jun 3, 2024
49ccc1f
fix: rename class
Marwaxhello Jun 3, 2024
6e1a510
style: added styling to card and cardgroup components
Marwaxhello Jun 4, 2024
85b1727
feat: added cardgroup READ ME file
Marwaxhello Jun 4, 2024
de66e55
refactor: card and cardgroup components structure tweaks
Marwaxhello Jun 4, 2024
c31e382
build: added children (Heading and Paragraph) to card and cardgroup c…
Marwaxhello Jun 4, 2024
d475215
build: added padding tokens
Marwaxhello Jun 5, 2024
1ada930
build: add fira sans to font package.json
TessaViergever Jun 3, 2024
3bdc2f5
feat: add fira sans font
TessaViergever Jun 4, 2024
b188956
refactor: change import name
Marwaxhello Jun 5, 2024
1fb16a7
feat:
Marwaxhello Jun 5, 2024
69314e6
refactor: rename font-family
Marwaxhello Jun 5, 2024
93892ec
style: added tokens to card component
Marwaxhello Jun 5, 2024
2c18995
style: added margin-block-end token
Marwaxhello Jun 5, 2024
ac6878c
style: grid styling for cardgroup component
Marwaxhello Jun 5, 2024
cc757ee
refactor: heading and headinglevel elemets added to new structure
Marwaxhello Jun 12, 2024
741914c
style: heading styling added to heading class
Marwaxhello Jun 12, 2024
1c62a77
refactor: added heading in args and paragraph in children
Marwaxhello Jun 12, 2024
349cfdb
refactor: change margin block end size
Marwaxhello Jun 12, 2024
22587b4
style: added media and container queries to card
Marwaxhello Jun 12, 2024
61fdc1a
style: renamed token names and added card content margin block
Marwaxhello Jun 12, 2024
0b4dad3
style: font size with container queries
Marwaxhello Jun 12, 2024
cad6a0e
build: add card css to card group index
Marwaxhello Jun 12, 2024
7d62057
refactor: token structure clean up
Marwaxhello Jun 12, 2024
66b780d
refactor: removed heading 3 from import
Marwaxhello Jun 12, 2024
8739722
feat: added gap to tokens for card group
Marwaxhello Jun 14, 2024
abdfde8
refactor: removed unnecessary grids in media queries and added gap token
Marwaxhello Jun 14, 2024
e2a73f3
refactor: added children to react card stories
Marwaxhello Jun 14, 2024
a5de486
refactor: Heading name Uppercase
Marwaxhello Jun 14, 2024
996acd5
style: container querie to paragraph content added
Marwaxhello Jun 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/components-css/card-group/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- @license CC0-1.0 -->

# Frameless CardGroup component
24 changes: 24 additions & 0 deletions packages/components-css/card-group/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.frameless-card-group {
container-type: inline-size;
Marwaxhello marked this conversation as resolved.
Show resolved Hide resolved
display: grid;
gap: var(--frameless-card-group-gap);
grid-auto-flow: dense;
}

@media (width >= 600px) {
.frameless-card-group {
grid-template-columns: 1fr 1fr;
}
}

@media (width <= 900px) {
.frameless-card-group {
grid-template-columns: 1fr;
}
}

@container (max-width: 400px) {
.frameless-card {
--utrecht-paragraph-font-size: var(--frameless-card-paragraph-font-size);
Marwaxhello marked this conversation as resolved.
Show resolved Hide resolved
}
}
3 changes: 3 additions & 0 deletions packages/components-css/card/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- @license CC0-1.0 -->

# Frameless Card component
38 changes: 38 additions & 0 deletions packages/components-css/card/index.scss
Marwaxhello marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.frameless-card {
background-color: var(--frameless-card-color-background-color);
border-radius: var(--frameless-card-border-border-radius);
font-family: var(--frameless-card-font-font-family);
max-inline-size: var(--frameless-card-spacing-max-width);
padding-block-end: var(--frameless-card-spacing-padding-block-end);
padding-block-start: var(--frameless-card-spacing-padding-block-start);
padding-inline-end: var(--frameless-card-spacing-padding-inline-end);
padding-inline-start: var(--frameless-card-spacing-padding-inline-start);
}

.frameless-card__content {
Marwaxhello marked this conversation as resolved.
Show resolved Hide resolved
--utrecht-paragraph-margin-block-end: var(--frameless-card-paragraph-margin-block-end);
--utrecht-space-around: 1;
}

@container (max-width: 400px) {
.frameless-card__content {
--utrecht-paragraph-font-size: var(--frameless-card-paragraph-font-size);
}
}

.frameless-card__heading {
--utrecht-heading-2-font-size: var(--frameless-card-heading-font-size);
--utrecht-heading-3-font-size: var(--frameless-card-heading-font-size);
--utrecht-heading-4-font-size: var(--frameless-card-heading-font-size);
--utrecht-heading-5-font-size: var(--frameless-card-heading-font-size);
--utrecht-heading-6-font-size: var(--frameless-card-heading-font-size);
--utrecht-heading-2-margin-block-end: var(--frameless-card-heading-margin-block-end);
--utrecht-heading-3-margin-block-end: var(--frameless-card-heading-margin-block-end);
--utrecht-heading-4-margin-block-end: var(--frameless-card-heading-margin-block-end);
--utrecht-heading-5-margin-block-end: var(--frameless-card-heading-margin-block-end);
--utrecht-heading-6-margin-block-end: var(--frameless-card-heading-margin-block-end);
--utrecht-heading-4-line-height: var(--frameless-card-line-height);
--utrecht-heading-5-line-height: var(--frameless-card-line-height);
--utrecht-heading-6-line-height: var(--frameless-card-line-height);
--utrecht-space-around: 1;
Marwaxhello marked this conversation as resolved.
Show resolved Hide resolved
}
26 changes: 26 additions & 0 deletions packages/components-react/src/Card/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Heading } from '@utrecht/component-library-react';
import clsx from 'clsx';
import { HTMLAttributes, PropsWithChildren } from 'react';
import '@frameless/components-css/card/index.scss';

interface CardProps extends HTMLAttributes<HTMLElement> {
heading?: string;
headingLevel?: number;
}

export const Card = ({
children,
heading,
Marwaxhello marked this conversation as resolved.
Show resolved Hide resolved
headingLevel = 2,
className,
...restProps
}: PropsWithChildren<CardProps>) => (
<div {...restProps} className={clsx('frameless-card', className)}>
{heading && (
<Heading className="frameless-card__heading" level={headingLevel}>
{heading}
</Heading>
)}
<div className="frameless-card__content">{children}</div>
</div>
);
16 changes: 16 additions & 0 deletions packages/components-react/src/CardGroup/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import clsx from 'clsx';
import { ForwardedRef, forwardRef, HTMLAttributes, PropsWithChildren } from 'react';
import '@frameless/components-css/card-group/index.scss';
import '@frameless/components-css/card/index.scss';

export type CardGroupProps = HTMLAttributes<HTMLDivElement>;

export const CardGroup = forwardRef(
({ children, className, ...restProps }: PropsWithChildren<CardGroupProps>, ref: ForwardedRef<HTMLDivElement>) => (
<div {...restProps} ref={ref} className={clsx('frameless-card-group', className)}>
{children}
</div>
),
);

CardGroup.displayName = 'CardGroup';
2 changes: 2 additions & 0 deletions packages/components-react/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export { Heading1 } from '@utrecht/component-library-react';
export { Card } from './Card';
export { CardGroup } from './CardGroup';
141 changes: 141 additions & 0 deletions packages/storybook/src/css-card.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
import '@frameless/components-css/card/index.scss';
import readme from '@frameless/components-css/card/README.md?raw';
import { Card } from '@frameless/components-react/src/Card';
import type { Meta, StoryObj } from '@storybook/react';
import { Paragraph } from '@utrecht/component-library-react';

const meta = {
title: 'CSS Component/Card',
id: 'css-card',
component: Card,
argTypes: {
children: {
name: 'Content',
description: 'Card',
type: {
name: 'string',
required: true,
},
defaultValue: '',
},
},
args: {
children: '',
},
tags: ['autodocs'],
parameters: {
docs: {
description: {
component: readme,
},
},
},
} satisfies Meta<typeof Card>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
children: (
<>
<Paragraph>
Herbruikbare componenten onafhankelijk van huisstijl, daar mag je ons voor wakker maken! Frameless heeft al
aan meerdere white-label design systems mogen werken en is trots op onze bijdrage aan NL Design System.
</Paragraph>
</>
),
},
};

export const LongHeading: Story = {
args: {
heading: 'The quick brown fox jumps over the lazy dog',
children: (
<>
<Paragraph>
Herbruikbare componenten onafhankelijk van huisstijl, daar mag je ons voor wakker maken! Frameless heeft al
aan meerdere white-label design systems mogen werken en is trots op onze bijdrage aan NL Design System.
</Paragraph>
</>
),
},
};

export const Empty: Story = {
Marwaxhello marked this conversation as resolved.
Show resolved Hide resolved
args: {
children: '',
},
};

export const WithHeading2: Story = {
args: {
heading: 'Design Systems',
children: (
<>
<Paragraph>
Herbruikbare componenten onafhankelijk van huisstijl, daar mag je ons voor wakker maken! Frameless heeft al
aan meerdere white-label design systems mogen werken en is trots op onze bijdrage aan NL Design System.
</Paragraph>
</>
),
},
};
export const WithHeading3: Story = {
args: {
heading: 'Design Systems',
headingLevel: 3,
children: (
<>
<Paragraph>
Herbruikbare componenten onafhankelijk van huisstijl, daar mag je ons voor wakker maken! Frameless heeft al
aan meerdere white-label design systems mogen werken en is trots op onze bijdrage aan NL Design System.
</Paragraph>
</>
),
},
};
export const WithHeading4: Story = {
args: {
heading: 'Design Systems',
headingLevel: 4,
children: (
<>
<Paragraph>
Herbruikbare componenten onafhankelijk van huisstijl, daar mag je ons voor wakker maken! Frameless heeft al
aan meerdere white-label design systems mogen werken en is trots op onze bijdrage aan NL Design System.
</Paragraph>
</>
),
},
};
export const WithHeading5: Story = {
args: {
heading: 'Design Systems',
headingLevel: 5,
children: (
<>
<Paragraph>
Herbruikbare componenten onafhankelijk van huisstijl, daar mag je ons voor wakker maken! Frameless heeft al
aan meerdere white-label design systems mogen werken en is trots op onze bijdrage aan NL Design System.
</Paragraph>
</>
),
},
};

export const WithHeading6: Story = {
args: {
heading: 'Design Systems',
headingLevel: 6,
children: (
<>
<Paragraph>
Herbruikbare componenten onafhankelijk van huisstijl, daar mag je ons voor wakker maken! Frameless heeft al
aan meerdere white-label design systems mogen werken en is trots op onze bijdrage aan NL Design System.
</Paragraph>
</>
),
},
};
62 changes: 62 additions & 0 deletions packages/storybook/src/css-cardgroup.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/* @license CC0-1.0 */

import '@frameless/components-css/card/index.scss';
import readme from '@frameless/components-css/card-group/README.md?raw';
import { Card } from '@frameless/components-react/src/Card';
import { CardGroup } from '@frameless/components-react/src/CardGroup';
import type { Meta, StoryObj } from '@storybook/react';
import { Paragraph } from '@utrecht/component-library-react';

const meta = {
title: 'CSS Component/CardGroup',
id: 'css-card-group',
component: CardGroup,
argTypes: {
children: {
name: 'Content',
description: 'CardGroup',
type: {
name: 'string',
required: true,
},
defaultValue: '',
},
},
args: {
children: '',
},
tags: ['autodocs'],
parameters: {
docs: {
description: {
component: readme,
},
},
},
} satisfies Meta<typeof CardGroup>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
children: (
<>
<Card heading="Design System" headingLevel={2}>
<Paragraph>
Herbruikbare componenten onafhankelijk van huisstijl, daar mag je ons voor wakker maken! Frameless heeft al
aan meerdere white-label design systems mogen werken en is trots op onze bijdrage aan NL Design System.
</Paragraph>
</Card>
<Card heading="Design System" headingLevel={2}>
<Paragraph>
Herbruikbare componenten onafhankelijk van huisstijl, daar mag je ons voor wakker maken! Frameless heeft al
aan meerdere white-label design systems mogen werken en is trots op onze bijdrage aan NL Design System.
</Paragraph>
</Card>
</>
),
},
name: 'Frameless CardGroup',
Marwaxhello marked this conversation as resolved.
Show resolved Hide resolved
};
2 changes: 0 additions & 2 deletions packages/storybook/src/css-stories/heading1.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/* @license CC0-1.0 */

// import readme from '@frameless/components-css/heading1/README.md?raw';
import type { Meta, StoryObj } from '@storybook/react';
import { Heading1 } from '@utrecht/component-library-react/dist/css-module';
// import { Heading1 } from '@frameless/components-react'; // TODO: use frameless package instead
// import '@frameless/components-css/heading1/index.scss';

const meta = {
title: 'CSS Component/Heading1',
Expand Down
Loading