-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[Sistent] Add Card component documentation to Sistent components page #7450
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
Open
shteypandey28-hue
wants to merge
4
commits into
layer5io:master
Choose a base branch
from
shteypandey28-hue:sistent-card-docs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
52c24be
[Sistent] Add Card component documentation
shteypandey28-hue af2971a
[Sistent] Fix Card guidance page alignment
shteypandey28-hue 1b2d639
[Sistent] Fix Card navigation order in SistentNavigation
shteypandey28-hue 2339ccf
[Sistent] Fix Card nav: clean formatting, correct order
shteypandey28-hue File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,241 @@ | ||
| import React from "react"; | ||
| import { navigate } from "gatsby"; | ||
| import { useLocation } from "@reach/router"; | ||
|
|
||
| import { | ||
| SistentThemeProvider, | ||
| Card, | ||
| CardHeader, | ||
| CardContent, | ||
| CardActions, | ||
| Button, | ||
| Typography, | ||
| } from "@sistent/sistent"; | ||
| import { CodeBlock } from "../button/code-block"; | ||
| import { SistentLayout } from "../../sistent-layout"; | ||
|
|
||
| import TabButton from "../../../../../reusecore/Button"; | ||
| import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode"; | ||
|
|
||
| const codes = [ | ||
| `<SistentThemeProvider> | ||
| <Card sx={{ maxWidth: 345 }}> | ||
| <CardContent> | ||
| <Typography variant="h5" component="div"> | ||
| Basic Card | ||
| </Typography> | ||
| <Typography variant="body2" color="text.secondary"> | ||
| This is a simple card with only content inside it. | ||
| </Typography> | ||
| </CardContent> | ||
| </Card> | ||
| </SistentThemeProvider>`, | ||
| `<SistentThemeProvider> | ||
| <Card sx={{ maxWidth: 345 }}> | ||
| <CardHeader | ||
| title="Card Title" | ||
| subheader="Card Subheader" | ||
| /> | ||
| <CardContent> | ||
| <Typography variant="body2" color="text.secondary"> | ||
| This card includes a header with a title and subheader, | ||
| followed by descriptive body content. | ||
| </Typography> | ||
| </CardContent> | ||
| </Card> | ||
| </SistentThemeProvider>`, | ||
| `<SistentThemeProvider> | ||
| <Card sx={{ maxWidth: 345 }}> | ||
| <CardMedia | ||
| component="img" | ||
| height="140" | ||
| image="https://source.unsplash.com/random/345x140" | ||
| alt="Card media" | ||
| /> | ||
| <CardContent> | ||
| <Typography variant="h5" component="div"> | ||
| Card with Media | ||
| </Typography> | ||
| <Typography variant="body2" color="text.secondary"> | ||
| This card uses CardMedia to display an image at the top. | ||
| </Typography> | ||
| </CardContent> | ||
| </Card> | ||
| </SistentThemeProvider>`, | ||
| `<SistentThemeProvider> | ||
| <Card sx={{ maxWidth: 345 }}> | ||
| <CardContent> | ||
| <Typography variant="h5" component="div"> | ||
| Card with Actions | ||
| </Typography> | ||
| <Typography variant="body2" color="text.secondary"> | ||
| Cards can include action buttons at the bottom for user interaction. | ||
| </Typography> | ||
| </CardContent> | ||
| <CardActions> | ||
| <Button size="small">Learn More</Button> | ||
| <Button size="small">Share</Button> | ||
| </CardActions> | ||
| </Card> | ||
| </SistentThemeProvider>`, | ||
| ]; | ||
|
|
||
| const CardCode = () => { | ||
| const location = useLocation(); | ||
| const { isDark } = useStyledDarkMode(); | ||
|
|
||
| return ( | ||
| <SistentLayout title="Card"> | ||
| <div className="content"> | ||
| <a id="Identity"> | ||
| <h2>Card</h2> | ||
| </a> | ||
| <p> | ||
| The <code>Card</code> component is a surface that displays content and | ||
| actions on a single topic. Cards are composed of sub-components such | ||
| as <code>CardHeader</code>, <code>CardContent</code>,{" "} | ||
| <code>CardActions</code>, and <code>CardMedia</code>, which can be | ||
| combined to create a variety of layouts. | ||
| </p> | ||
| <div className="filterBtns"> | ||
| <TabButton | ||
| className={ | ||
| location.pathname === "/projects/sistent/components/card" | ||
| ? "active" | ||
| : "" | ||
| } | ||
| onClick={() => navigate("/projects/sistent/components/card")} | ||
| title="Overview" | ||
| /> | ||
| <TabButton | ||
| className={ | ||
| location.pathname === "/projects/sistent/components/card/guidance" | ||
| ? "active" | ||
| : "" | ||
| } | ||
| onClick={() => | ||
| navigate("/projects/sistent/components/card/guidance") | ||
| } | ||
| title="Guidance" | ||
| /> | ||
| <TabButton | ||
| className={ | ||
| location.pathname === "/projects/sistent/components/card/code" | ||
| ? "active" | ||
| : "" | ||
| } | ||
| onClick={() => navigate("/projects/sistent/components/card/code")} | ||
| title="Code" | ||
| /> | ||
| </div> | ||
| <div className="main-content"> | ||
| <p> | ||
| The following examples demonstrate the different ways to use the{" "} | ||
| <code>Card</code> component and its sub-components. | ||
| </p> | ||
| <a id="Basic Card"> | ||
| <h2>Basic Card</h2> | ||
| </a> | ||
| <p> | ||
| A minimal card with only <code>CardContent</code> displaying a title | ||
| and description. | ||
| </p> | ||
| <div className="showcase"> | ||
| <div className="items"> | ||
| <SistentThemeProvider initialMode={isDark ? "dark" : "light"}> | ||
| <Card sx={{ maxWidth: 345 }}> | ||
| <CardContent> | ||
| <Typography variant="h5" component="div"> | ||
| Basic Card | ||
| </Typography> | ||
| <Typography variant="body2" color="text.secondary"> | ||
| This is a simple card with only content inside it. | ||
| </Typography> | ||
| </CardContent> | ||
| </Card> | ||
| </SistentThemeProvider> | ||
| </div> | ||
| <CodeBlock name="card-basic" code={codes[0]} /> | ||
| </div> | ||
| <a id="Card with Header and Content"> | ||
| <h2>Card with Header and Content</h2> | ||
| </a> | ||
| <p> | ||
| Combining <code>CardHeader</code> and <code>CardContent</code> to | ||
| present a titled card with body text. | ||
| </p> | ||
| <div className="showcase"> | ||
| <div className="items"> | ||
| <SistentThemeProvider initialMode={isDark ? "dark" : "light"}> | ||
| <Card sx={{ maxWidth: 345 }}> | ||
| <CardHeader title="Card Title" subheader="Card Subheader" /> | ||
| <CardContent> | ||
| <Typography variant="body2" color="text.secondary"> | ||
| This card includes a header with a title and subheader, | ||
| followed by descriptive body content. | ||
| </Typography> | ||
| </CardContent> | ||
| </Card> | ||
| </SistentThemeProvider> | ||
| </div> | ||
| <CodeBlock name="card-header-content" code={codes[1]} /> | ||
| </div> | ||
| <a id="Card with Media"> | ||
| <h2>Card with Media</h2> | ||
| </a> | ||
| <p> | ||
| Use <code>CardMedia</code> to embed an image within the card. | ||
| </p> | ||
| <div className="showcase"> | ||
| <div className="items"> | ||
| <SistentThemeProvider initialMode={isDark ? "dark" : "light"}> | ||
| <Card sx={{ maxWidth: 345 }}> | ||
| <CardContent> | ||
| <Typography variant="h5" component="div"> | ||
| Card with Media | ||
| </Typography> | ||
| <Typography variant="body2" color="text.secondary"> | ||
| This card uses CardMedia to display an image at the top. | ||
| </Typography> | ||
| </CardContent> | ||
| </Card> | ||
| </SistentThemeProvider> | ||
| </div> | ||
| <CodeBlock name="card-media" code={codes[2]} /> | ||
| </div> | ||
| <a id="Card with Actions"> | ||
| <h2>Card with Actions</h2> | ||
| </a> | ||
| <p> | ||
| Use <code>CardActions</code> to place interactive buttons at the | ||
| bottom of the card. | ||
| </p> | ||
| <div className="showcase"> | ||
| <div className="items"> | ||
| <SistentThemeProvider initialMode={isDark ? "dark" : "light"}> | ||
| <Card sx={{ maxWidth: 345 }}> | ||
| <CardContent> | ||
| <Typography variant="h5" component="div"> | ||
| Card with Actions | ||
| </Typography> | ||
| <Typography variant="body2" color="text.secondary"> | ||
| Cards can include action buttons at the bottom for user | ||
| interaction. | ||
| </Typography> | ||
| </CardContent> | ||
| <CardActions> | ||
| <Button size="small">Learn More</Button> | ||
| <Button size="small">Share</Button> | ||
| </CardActions> | ||
| </Card> | ||
| </SistentThemeProvider> | ||
| </div> | ||
| <CodeBlock name="card-actions" code={codes[3]} /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </SistentLayout> | ||
| ); | ||
| }; | ||
|
|
||
| export default CardCode; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the IDs and, as @saurabhraghuvanshii suggested, only add relevant changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please present at the upcoming website meeting on Monday.