-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat: implement responsive canvas schemas card component #7805
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
Joiejoie1
wants to merge
2
commits into
layer5io:master
Choose a base branch
from
Joiejoie1:feat/animated-card-6521
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
2 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 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,67 @@ | ||
| import React from "react"; | ||
|
|
||
| export const MesherySchemasCard = ({ | ||
| tags = ["AWS", "Azure", "GCP"], | ||
| title = "Cloud Native Management", | ||
| description = "Design, optimize and maintain your infrastructure with powerful schema tools.", | ||
| actionText = "Manage", | ||
| statusText = "Live", | ||
| onActionClick, | ||
| }) => { | ||
| return ( | ||
| <div | ||
| style={{ | ||
| width: "100%", | ||
| maxWidth: "340px", | ||
| background: "#0b132b", | ||
| borderRadius: "1rem", | ||
| padding: "1.5rem", | ||
| border: "1px solid #00b39f", | ||
| color: "#fff", | ||
| }} | ||
| > | ||
| <div style={{ display: "flex", gap: "0.5rem", marginBottom: "1rem" }}> | ||
| {tags.map((tag) => ( | ||
| <span | ||
| key={tag} | ||
| style={{ | ||
| background: "rgba(0,179,159,0.2)", | ||
| padding: "0.25rem 0.5rem", | ||
| borderRadius: "4px", | ||
| fontSize: "10px", | ||
| color: "#00b39f", | ||
| }} | ||
| > | ||
| {tag} | ||
| </span> | ||
| ))} | ||
| </div> | ||
| <h3 style={{ fontSize: "1.1rem", margin: "0 0 0.5rem 0" }}>{title}</h3> | ||
| <p style={{ fontSize: "0.8rem", color: "#ccc", margin: "0 0 1.5rem 0" }}> | ||
| {description} | ||
| </p> | ||
| <div | ||
| style={{ | ||
| display: "flex", | ||
| justifyContent: "space-between", | ||
| alignItems: "center", | ||
| }} | ||
| > | ||
| <button | ||
| onClick={onActionClick} | ||
| style={{ | ||
| background: "#00b39f", | ||
| color: "#fff", | ||
| border: "none", | ||
| padding: "0.5rem 1rem", | ||
| borderRadius: "4px", | ||
| fontSize: "0.8rem", | ||
| }} | ||
| > | ||
| {actionText} | ||
| </button> | ||
| <span style={{ fontSize: "0.8rem", color: "#888" }}>{statusText}</span> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
55 changes: 46 additions & 9 deletions
55
src/sections/Kanvas/FeaturesSection/Design/DesignerFeatures_diagram.js
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 |
|---|---|---|
| @@ -1,24 +1,61 @@ | ||
| import React from "react"; | ||
| import DiagramStyles from "../../diagram/diagram.style"; | ||
| import { ReactComponent as RoleBind1 } from "./images/role-binding-1-colorMode.svg"; | ||
| import { ReactComponent as RoleBind2 } from "./images/role-binding-2-colorMode.svg"; | ||
| import { ReactComponent as RoleBind3 } from "./images/role-binding-3-colorMode.svg"; | ||
| import { ReactComponent as RoleBind4 } from "./images/role-binding-4-colorMode.svg"; | ||
| import RoleBind2 from "./images/role-binding-2-colorMode.svg"; | ||
| import RoleBind3 from "./images/role-binding-3-colorMode.svg"; | ||
| import RoleBind4 from "./images/role-binding-4-colorMode.svg"; | ||
| import { useInView } from "react-intersection-observer"; | ||
| import { MesherySchemasCard } from "../../../../components/MesherySchemasCard"; | ||
|
|
||
| const DesignerFeaturesDiagram = ({ activeExampleIndex }) => { | ||
| const [ref, inView] = useInView({ threshold: 0.6 }); | ||
|
|
||
| return ( | ||
| <DiagramStyles> | ||
| <div className="root" ref={ref} style={{ minHeight: "25rem" }}> | ||
| <RoleBind1 className={(inView && activeExampleIndex == 0) ? "show" : "render"} id="design-image1" alt="design-image1"/> | ||
| <RoleBind2 id="design-image2" className={(activeExampleIndex == 1) ? "show" : "render"} alt="design-image2" /> | ||
| <RoleBind3 id="design-image3" className={(activeExampleIndex == 2) ? "show" : "render"} alt="design-image3" /> | ||
| <RoleBind4 id="design-image4" className={(activeExampleIndex >= 3) ? "show" : "render"} alt="design-image4" /> | ||
| <div | ||
| id="design-image1" | ||
| className={inView && activeExampleIndex === 0 ? "show" : "render"} | ||
| style={{ | ||
| display: "flex", | ||
| justifyContent: "center", | ||
| alignItems: "center", | ||
| width: "100%", | ||
| transition: "opacity 0.4s ease-in-out, transform 0.4s ease-in-out", | ||
| }} | ||
| > | ||
| <MesherySchemasCard | ||
| tags={["AWS", "Azure", "GCP"]} | ||
| title="Cloud Native Management" | ||
| description="Design, optimize and maintain your infrastructure with powerful schema tools." | ||
| actionText="Manage" | ||
| statusText="Live" | ||
| onActionClick={() => | ||
| console.log("Schema management console active!") | ||
| } | ||
| /> | ||
| </div> | ||
|
|
||
| <img | ||
| id="design-image2" | ||
| src={RoleBind2} | ||
| className={activeExampleIndex === 1 ? "show" : "render"} | ||
| alt="design-image2" | ||
| /> | ||
| <img | ||
| id="design-image3" | ||
| src={RoleBind3} | ||
| className={activeExampleIndex === 2 ? "show" : "render"} | ||
| alt="design-image3" | ||
| /> | ||
| <img | ||
| id="design-image4" | ||
| src={RoleBind4} | ||
| className={activeExampleIndex >= 3 ? "show" : "render"} | ||
| alt="design-image4" | ||
| /> | ||
| </div> | ||
| </DiagramStyles> | ||
| ); | ||
| }; | ||
|
|
||
| export default DesignerFeaturesDiagram; | ||
| export default DesignerFeaturesDiagram; |
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.
The
onActionClickprop is passed toMesherySchemasCard, but it is not used inside the component. As a result, clicking the Manage button does not trigger any action. Could you please check and wire the prop to the button if it is intended to be functional?Also, the PR is currently missing the required DCO sign-off.
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.
Hi @Sbragul26, thank you for the catch and the review!
onActionClick Prop: That was an oversight on my part. I will wire the onActionClick prop directly to the onClick handler of the "Manage" button right away so that it triggers the intended action successfully.
DCO Sign-off: Ah, it looks like my previous amend didn't fully propagate or a new commit pushed without the flag. I will re-verify my GPG/SSH environment settings in the workspace, sign the commit properly using git commit --amend -S --no-edit, and force-push it to clear the DCO check.
I'll push the updates shortly!
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.
Hi @Sbragul26 ,
I have updated the component to wire the onActionClick prop directly to the "Manage" button. I also amended the commit with the proper -s flag to append the required DCO sign-off. Everything should be clean and ready for another look. Thanks for the review!