-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Sistent Card Component #6117
Open
Anand-Theertha
wants to merge
4
commits into
layer5io:master
Choose a base branch
from
Anand-Theertha:sistent-card
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.
+636
−0
Open
Sistent Card Component #6117
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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 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,259 @@ | ||
import React from "react"; | ||
import { navigate } from "gatsby"; | ||
import { useLocation } from "@reach/router"; | ||
|
||
import { SistentThemeProvider, Card, CardActions, CardContent, CardMedia , Typography, Button } from "@layer5/sistent"; | ||
import { CodeBlock } from "../button/code-block"; | ||
import { SistentLayout } from "../../sistent-layout"; | ||
|
||
import MesheryLogo from "../../../../../assets/images/meshery/meshery-logo-light-text-side.webp"; | ||
import KanvasLogo from "../../../../../assets/images/kanvas/icon-only/kanvas-icon-color.png"; | ||
|
||
import TabButton from "../../../../../reusecore/Button"; | ||
import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode"; | ||
|
||
const codes = [ | ||
`const cardOutlined = ( | ||
<React.Fragment> | ||
<CardContent> | ||
<Typography gutterBottom sx={{ color: "text.secondary", fontSize: 14 }}> | ||
Company Spotlight | ||
</Typography> | ||
<Typography variant="h5" component="div"> | ||
Layer5 | ||
</Typography> | ||
<Typography sx={{ color: "text.secondary", fontSize: 14 , mb: 1.5 }}>Platform</Typography> | ||
<Typography variant="body2"> | ||
Empowering engineers with cloud-native management solutions. | ||
</Typography> | ||
</CardContent> | ||
<CardActions> | ||
<Button size="small">Learn More</Button> | ||
</CardActions> | ||
</React.Fragment> | ||
); | ||
|
||
<Card variant="outlined">{cardOutlined}</Card> | ||
`, | ||
|
||
`const cardMainAction1 = ( | ||
<Card sx={{ maxWidth: 345 }}> | ||
<CardActions> | ||
<CardMedia | ||
component="img" | ||
height="90" | ||
image={MesheryLogo} | ||
alt="Meshery" | ||
/> | ||
<CardContent> | ||
<Typography gutterBottom variant="h5" component="div"> | ||
Meshery | ||
</Typography> | ||
<Typography variant="body2" sx={{ color: "text.secondary" }}> | ||
Meshery is an open-source cloud-native management platform. | ||
</Typography> | ||
</CardContent> | ||
</CardActions> | ||
</Card> | ||
); | ||
|
||
<Card variant="outlined">{cardMainAction1}</Card> | ||
`, | ||
|
||
` | ||
const cardMainAction2 = ( | ||
<Card sx={{ maxWidth: 345 }}> | ||
<CardActions> | ||
<CardMedia | ||
component="img" | ||
height="80" | ||
image={KanvasLogo} | ||
alt="Kanvas" | ||
/> | ||
<CardContent> | ||
<Typography gutterBottom variant="h5" component="div"> | ||
Kanvas | ||
</Typography> | ||
<Typography variant="body2" sx={{ color: "text.secondary" }}> | ||
Kanvas is a collaborative design tool. | ||
</Typography> | ||
</CardContent> | ||
</CardActions> | ||
<CardActions> | ||
<Button size="small" color="primary"> | ||
Share | ||
</Button> | ||
</CardActions> | ||
</Card> | ||
); | ||
|
||
<Card variant="outlined">{cardMainAction2}</Card> | ||
`, | ||
]; | ||
|
||
const CardCode = () => { | ||
const location = useLocation(); | ||
const { isDark } = useStyledDarkMode(); | ||
|
||
const cardOutlined = ( | ||
<React.Fragment> | ||
<CardContent> | ||
<Typography gutterBottom sx={{ color: "text.secondary", fontSize: 14 }}> | ||
Company Spotlight | ||
</Typography> | ||
<Typography variant="h5" component="div"> | ||
Layer5 | ||
</Typography> | ||
<Typography sx={{ color: "text.secondary", fontSize: 14 , mb: 1.5 }}>Platform</Typography> | ||
<Typography variant="body2"> | ||
Empowering engineers with cloud-native management solutions. | ||
</Typography> | ||
</CardContent> | ||
<CardActions> | ||
<Button size="small">Learn More</Button> | ||
</CardActions> | ||
</React.Fragment> | ||
); | ||
|
||
const cardMainAction1 = ( | ||
<Card sx={{ maxWidth: 345 }}> | ||
<CardActions> | ||
<CardMedia | ||
component="img" | ||
height="80" | ||
image={MesheryLogo} | ||
alt="Meshery" | ||
/> | ||
<CardContent> | ||
<Typography gutterBottom variant="h5" component="div"> | ||
Meshery | ||
</Typography> | ||
<Typography variant="body2" sx={{ color: "text.secondary" }}> | ||
Meshery is an open-source cloud-native management platform designed to help users manage, monitor, and optimize the performance of service meshes and their workloads. | ||
</Typography> | ||
</CardContent> | ||
</CardActions> | ||
</Card> | ||
); | ||
|
||
const cardMainAction2 = ( | ||
<Card sx={{ maxWidth: 345 }}> | ||
<CardActions> | ||
<CardMedia | ||
component="img" | ||
height="90" | ||
image={KanvasLogo} | ||
alt="Kanvas" | ||
/> | ||
<CardContent> | ||
<Typography gutterBottom variant="h5" component="div"> | ||
Kanvas | ||
</Typography> | ||
<Typography variant="body2" sx={{ color: "text.secondary" }}> | ||
Kanvas is a collaborative design tool that allows users to create, edit, and manage visual assets seamlessly within a shared workspace. | ||
</Typography> | ||
</CardContent> | ||
</CardActions> | ||
<CardActions> | ||
<Button size="small" color="primary"> | ||
Share | ||
</Button> | ||
</CardActions> | ||
</Card> | ||
); | ||
|
||
return ( | ||
<SistentLayout title="Card"> | ||
<div className="content"> | ||
<a id="Identity"> | ||
<h2>Card</h2> | ||
</a> | ||
<p>The Card component is a UI element used to encapsulate information or actions related to a single topic, typically in a visually separated, easily digestible format. It often includes elements like images, text, and buttons to present content and enable quick interactions without navigating away from the card.</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> | ||
A card often lets users interact with its entire surface to trigger its main function, whether it’s expanding, navigating to another screen, or activating some other behavior. | ||
</p> | ||
<a id="Outlined Card"> | ||
<h2>Oultined Card Example</h2> | ||
</a> | ||
<p> | ||
An outlined card is a variation of the standard card component, often used to provide a lighter, more minimalist design. Instead of a solid background or shadow, an outlined card uses a border to define its boundaries, giving it a cleaner and more refined appearance. | ||
</p> | ||
<div className="showcase"> | ||
<div className="items"> | ||
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}> | ||
<Card variant="outlined">{cardOutlined}</Card> | ||
</SistentThemeProvider> | ||
</div> | ||
<CodeBlock name="container-fluid-sm" code={codes[0]} /> | ||
</div> | ||
|
||
<div> | ||
<a id="Main Action Cards"> | ||
<h2>Main Action Cards</h2> | ||
</a> | ||
<p> | ||
This type of interactive card is well-suited for use in applications where quick access to more information or actions is important, such as dashboards, or product catalogs. For example, ont the website, users can tap anywhere on the card to open the full product page. | ||
</p> | ||
<div className="showcase"> | ||
<div className="items"> | ||
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}> | ||
<Card variant="outlined">{cardMainAction1}</Card> | ||
</SistentThemeProvider> | ||
</div> | ||
<CodeBlock name="Container-fluid-md" code={codes[1]} /> | ||
</div> | ||
</div> | ||
<p> | ||
Cards can also include secondary actions, which should be positioned away from the primary action area to avoid unintentional interaction conflicts. | ||
</p> | ||
<div className="showcase"> | ||
<div className="items"> | ||
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}> | ||
<Card variant="outlined">{cardMainAction2}</Card> | ||
</SistentThemeProvider> | ||
</div> | ||
<CodeBlock name="Container-fixed" code={codes[2]} /> | ||
</div> | ||
</div> | ||
</div> | ||
</SistentLayout> | ||
); | ||
}; | ||
|
||
export default CardCode; |
Oops, something went wrong.
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.
Rather than creating a new component, you can directly pass as a child component to Card. So that I will be easier to copy for developers in the future.