-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[WEB-4727] feat: propel cards #7630
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2b78ee8
feat: add card component to propel package and update tooltip imports
JayashTripathy f831af6
refactor: remove @plane/ui dependency and update tooltip imports to u…
JayashTripathy 980d0b8
fix: lint
JayashTripathy e3b2b61
refactor: update import from @plane/ui to @plane/utils in command com…
JayashTripathy bd86f01
Merge branch 'preview' into feat-propel-cards
JayashTripathy 90a0232
refactor: extend CardProps interface to include HTML attributes for b…
JayashTripathy 59f529c
Merge branch 'feat-propel-cards' of https://github.com/makeplane/plan…
JayashTripathy 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,41 @@ | ||
| import * as React from "react"; | ||
| import { cn } from "@plane/utils"; | ||
| import { | ||
| ECardDirection, | ||
| ECardSpacing, | ||
| ECardVariant, | ||
| getCardStyle, | ||
| TCardDirection, | ||
| TCardSpacing, | ||
| TCardVariant, | ||
| } from "./helper"; | ||
|
|
||
| export interface CardProps extends React.HTMLAttributes<HTMLDivElement> { | ||
| variant?: TCardVariant; | ||
| spacing?: TCardSpacing; | ||
| direction?: TCardDirection; | ||
| className?: string; | ||
| children: React.ReactNode; | ||
| } | ||
|
|
||
| const Card = React.forwardRef<HTMLDivElement, CardProps>((props, ref) => { | ||
| const { | ||
| variant = ECardVariant.WITH_SHADOW, | ||
| direction = ECardDirection.COLUMN, | ||
| className = "", | ||
| spacing = ECardSpacing.LG, | ||
| children, | ||
| ...rest | ||
| } = props; | ||
|
|
||
| const style = getCardStyle(variant, spacing, direction); | ||
| return ( | ||
| <div ref={ref} className={cn(style, className)} {...rest}> | ||
| {children} | ||
| </div> | ||
| ); | ||
| }); | ||
|
|
||
| Card.displayName = "plane-ui-card"; | ||
|
|
||
| export { Card, ECardVariant, ECardSpacing, ECardDirection }; | ||
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,36 @@ | ||
| export enum ECardVariant { | ||
| WITHOUT_SHADOW = "without-shadow", | ||
| WITH_SHADOW = "with-shadow", | ||
| } | ||
| export enum ECardDirection { | ||
| ROW = "row", | ||
| COLUMN = "column", | ||
| } | ||
| export enum ECardSpacing { | ||
| SM = "sm", | ||
| LG = "lg", | ||
| } | ||
| export type TCardVariant = ECardVariant.WITHOUT_SHADOW | ECardVariant.WITH_SHADOW; | ||
| export type TCardDirection = ECardDirection.ROW | ECardDirection.COLUMN; | ||
| export type TCardSpacing = ECardSpacing.SM | ECardSpacing.LG; | ||
|
|
||
| export interface ICardProperties { | ||
| [key: string]: string; | ||
| } | ||
|
|
||
| const DEFAULT_STYLE = | ||
| "bg-custom-background-100 rounded-lg border-[0.5px] border-custom-border-200 w-full flex flex-col"; | ||
| export const containerStyle: ICardProperties = { | ||
| [ECardVariant.WITHOUT_SHADOW]: "", | ||
| [ECardVariant.WITH_SHADOW]: "hover:shadow-custom-shadow-4xl duration-300", | ||
| }; | ||
| export const spacings = { | ||
| [ECardSpacing.SM]: "p-4", | ||
| [ECardSpacing.LG]: "p-6", | ||
| }; | ||
| export const directions = { | ||
| [ECardDirection.ROW]: "flex-row space-x-3", | ||
| [ECardDirection.COLUMN]: "flex-col space-y-3", | ||
| }; | ||
| export const getCardStyle = (variant: TCardVariant, spacing: TCardSpacing, direction: TCardDirection) => | ||
| DEFAULT_STYLE + " " + directions[direction] + " " + containerStyle[variant] + " " + spacings[spacing]; |
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 @@ | ||
| export * from "./card"; |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Uh oh!
There was an error while loading. Please reload this page.