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

Documented Card Component [feature/ds-428] #525

Merged
merged 7 commits into from
Nov 8, 2024
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
@@ -1,12 +1,12 @@
"use client";

import { useState, memo, type ReactNode, useCallback, useContext, useEffect } from "react";
import Card from "@/components/card/Card.tsx";
import ThemeSwitch from "@/components/themeSwitch/ThemeSwitch.tsx";
import { ThemeContext, type ColorScheme } from "@/context/theme/ThemeProvider.tsx";
import { memo, useCallback, useContext, useEffect, useState, type ReactNode } from "react";

import "./componentPreviewWrapper.css";
import { HopperProvider } from "@hopper-ui/components";
import "./componentPreviewWrapper.css";

interface ComponentPreviewWrapperProps {
preview?: ReactNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
height: 100%;
}

.hd-component-preview-wrapper__card.hd-card {
padding-bottom: var(--hd-space-8);
padding-top: var(--hd-space-8);
}

.hd-component-preview-wrapper[data-schema="light"] {
.hd-component-preview-wrapper__card {
--background: var(--hd-white);
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/app/ui/layout/header/assets/hopper-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion apps/docs/app/ui/layout/mobileMenu/assets/hopper-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 0 additions & 8 deletions apps/docs/content/components/collections/Listbox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ links:
TODO: links to related concepts
</FeatureFlag>

#### Header

The Header component represents a `header` within a Hopper container.

#### Section

The Section component represents a `section` within a Hopper container.

### Composed Components

#### ListBox
Expand Down
112 changes: 112 additions & 0 deletions apps/docs/content/components/content/Card.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
title: Card
description: Cards are used to group similar concepts and tasks to make it easier for users to scan, read and get things done.
category: "content"
links:
source: https://github.com/gsoft-inc/wl-hopper/blob/main/packages/components/src/Card/src/Card.tsx
---

<Example src="Card/docs/preview" isOpen />

<FeatureFlag flag="next">
## Guidelines

TODO: If we have some guidelines about this component&apos;s usage

### Accessibility ?

TODO: If we have some guidelines about this component and accessibility
</FeatureFlag>

## Anatomy

### Composed Components

A `Card` uses the following components.

<ComposedComponents components={["Header", "Content", "Footer"]}/>

<FeatureFlag flag="rc">

TODO: We have anatomy screenshots from the Figma, we could most likely use them here

### Concepts

TODO: links to related concepts
</FeatureFlag>

## Usage

### Variants

A card can use different variants. Second-level cards need to be used within a first-level card.

<Example src="Card/docs/variant" />

### Sections

A card can use a header, content, and footer section.

<Example src="Card/docs/sections" />

<FeatureFlag flag="next">
## Advanced customization

### Contexts
TODO: Example of context + content about the context

### Custom Children

TODO: Example of passing custom childrens to the components to fake a slot

### Custom Component

TODO: Example of creating a custom version of this component
</FeatureFlag>

## Props

<PropTable component="Card" />

## Migration Notes

<MigrateGuide src="Card/docs/migration-notes" />

### Layout Samples

To facilitate the migration process, we've provided layout samples as reference guides. These examples demonstrate how to recreate features previously supported in [Orbiter](https://wl-orbiter-website.netlify.app/?path=/docs/card--default-story).

#### Default

<Example src="Card/docs/migration/default" />

#### Image

<Example src="Card/docs/migration/image" />

#### Illustration

<Example src="Card/docs/migration/illustration" />

#### Size

<Example src="Card/docs/migration/size" />

#### Button

<Example src="Card/docs/migration/button" />

#### Button group

<Example src="Card/docs/migration/buttongroup" />


#### Orientation

<Example src="Card/docs/migration/orientation" />


#### Fluid

<Example src="Card/docs/migration/fluid" />

33 changes: 33 additions & 0 deletions apps/docs/examples/Preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,39 @@ export const Previews: Record<string, Preview> = {
"Avatar/docs/customization": {
component: lazy(() => import("@/../../packages/components/src/Avatar/docs/customization.tsx"))
},
"Card/docs/preview": {
component: lazy(() => import("@/../../packages/components/src/Card/docs/preview.tsx"))
},
"Card/docs/variant": {
component: lazy(() => import("@/../../packages/components/src/Card/docs/variant.tsx"))
},
"Card/docs/sections": {
component: lazy(() => import("@/../../packages/components/src/Card/docs/sections.tsx"))
},
"Card/docs/migration/default": {
component: lazy(() => import("@/../../packages/components/src/Card/docs/migration/default.tsx"))
},
"Card/docs/migration/image": {
component: lazy(() => import("@/../../packages/components/src/Card/docs/migration/image.tsx"))
},
"Card/docs/migration/illustration": {
component: lazy(() => import("@/../../packages/components/src/Card/docs/migration/illustration.tsx"))
},
"Card/docs/migration/size": {
component: lazy(() => import("@/../../packages/components/src/Card/docs/migration/size.tsx"))
},
"Card/docs/migration/button": {
component: lazy(() => import("@/../../packages/components/src/Card/docs/migration/button.tsx"))
},
"Card/docs/migration/buttongroup": {
component: lazy(() => import("@/../../packages/components/src/Card/docs/migration/buttongroup.tsx"))
},
"Card/docs/migration/orientation": {
component: lazy(() => import("@/../../packages/components/src/Card/docs/migration/orientation.tsx"))
},
"Card/docs/migration/fluid": {
component: lazy(() => import("@/../../packages/components/src/Card/docs/migration/fluid.tsx"))
},
"Divider/docs/preview": {
component: lazy(() => import("@/../../packages/components/src/Divider/docs/preview.tsx"))
},
Expand Down
1 change: 1 addition & 0 deletions apps/docs/examples/overview/Card.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion apps/docs/examples/overview/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Avatar from "./Avatar.svg";
import Badge from "./Badge.svg";
import Button from "./Button.svg";
import ButtonGroup from "./ButtonGroup.svg";
import Card from "./Card.svg";
import Checkbox from "./Checkbox.svg";
import CheckboxGroup from "./CheckboxGroup.svg";
import ComboBox from "./ComboBox.svg";
Expand Down Expand Up @@ -51,7 +52,7 @@ export const OverviewComponents: OverviewComponentsType = {
Badge,
Button,
ButtonGroup,
LinkButton,
Card,
Checkbox,
CheckboxGroup,
ComboBox,
Expand All @@ -71,6 +72,7 @@ export const OverviewComponents: OverviewComponentsType = {
Inline,
Label,
Link,
LinkButton,
ListBox,
NumberField,
PasswordField,
Expand Down
Loading