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

Card docs + preview #185

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"label": "Containers",
"link": {
"type": "generated-index"
}
}
19 changes: 19 additions & 0 deletions @stellar/design-system-website/docs/components/containers/card.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
slug: /card
---

# Card

<ComponentDescription componentName="Card" />

## Example

```tsx live
<PreviewBlock componentName="Card">
<Card>Content</Card>
</PreviewBlock>
```

## Props

<ComponentProps componentName="Card" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { ComponentPreview } from "@site/src/components/PreviewBlock";

export const cardPreview: ComponentPreview = {
options: [
{
type: "select",
prop: "variant",
options: [
{
value: "primary",
label: "Primary",
},
{
value: "secondary",
label: "Secondary",
},
],
},
{
type: "select",
prop: "borderRadiusSize",
options: [
{
value: "md",
label: "Medium radius",
},
{
value: "sm",
label: "Small radius",
},
],
},
{
type: "checkbox",
prop: "noPadding",
label: "No padding",
},
],
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { bannerPreview } from "@site/src/componentPreview/bannerPreview";
import { buttonPreview } from "@site/src/componentPreview/buttonPreview";
import { buttonPresetPreview } from "@site/src/componentPreview/buttonPresetPreview";
import { captionPreview } from "@site/src/componentPreview/captionPreview";
import { cardPreview } from "@site/src/componentPreview/cardPreview";
import { checkboxPreview } from "@site/src/componentPreview/checkboxPreview";
import { copyTextPreview } from "@site/src/componentPreview/copyTextPreview";
import { headingPreview } from "@site/src/componentPreview/headingPreview";
Expand Down Expand Up @@ -43,6 +44,7 @@ const previews: { [key: string]: ComponentPreview } = {
Button: buttonPreview,
ButtonPreset: buttonPresetPreview,
Caption: captionPreview,
Card: cardPreview,
Checkbox: checkboxPreview,
CopyText: copyTextPreview,
Heading: headingPreview,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@
flex-wrap: wrap;
gap: 0.5rem 1.5rem;
width: fit-content;
color: var(--color-gray-80);
}

.PreviewBlock__component {
min-height: 15rem;
display: flex;
align-items: center;
justify-content: center;
color: var(--color-gray-70);
}

@media (max-width: 600px) {
Expand Down Expand Up @@ -90,3 +92,7 @@
.PreviewBlock .Textarea {
max-width: 24rem;
}

.PreviewBlock .Checkbox__container label {
font-weight: var(--font-weight-regular);
}
10 changes: 9 additions & 1 deletion @stellar/design-system/src/components/Card/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import React from "react";
import "./styles.scss";

interface CardProps {
/** */
export interface CardProps {
/** Card content */
children: React.ReactNode;
/** Variant of the card @defaultValue `primary` */
variant?: "primary" | "secondary";
/** Remove card padding */
noPadding?: boolean;
/** Card border radius @defaultValue `md` */
borderRadiusSize?: "sm" | "md";
}

/**
* Container with flexible dimensions for any type of content.
*/
export const Card: React.FC<CardProps> = ({
children,
variant = "primary",
Expand Down
Loading