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

Feat/add listing component #82

Merged
merged 5 commits into from
Jul 10, 2024
Merged

Feat/add listing component #82

merged 5 commits into from
Jul 10, 2024

Conversation

mari1912
Copy link
Collaborator

@mari1912 mari1912 commented Jul 9, 2024

Description

  • Add a base card
  • Add a listing components card

Related Issues

How to test it

  • Run the storybook:
cd dashboard
pnpm run storybook

Visual reference

image

@mari1912 mari1912 requested a review from lfjnascimento July 9, 2024 19:34
@mari1912 mari1912 self-assigned this Jul 9, 2024

const BaseCard = ({title, content, className}: IBaseCard): JSX.Element => {
return (
<div className={className + containerClassName}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets use the classnames library

const ColoredCircle = ({quantity, type}: IColoredCircle): JSX.Element => {
const backgroundColor = type === ComponentType.Error ? "bg-lightRed" : "bg-yellow";
return(
<div className={backgroundColor + " rounded-full text-black h-6 min-w-6 flex justify-center"}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need some padding here
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary, it is a simple div

Comment on lines 44 to 49
{errors && errors > 0 ? (
<ColoredCircle quantity={errors} type={ComponentType.Error}/>
) : <></>}
{warnings && warnings > 0 ? (
<ColoredCircle quantity={warnings} type={ComponentType.Warning}/>
) : <></>}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: It will be better organized if we put this logic before the return

Error,
}

const ColoredCircle = ({quantity, type}: IColoredCircle): JSX.Element => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets extract this component into its own directory/file since it is more generic and we will use it in several other places

@mari1912 mari1912 force-pushed the feat/add-listing-component branch from b467789 to 431b610 Compare July 10, 2024 14:14
@@ -0,0 +1,25 @@
import classNames from 'classnames';

import { ComponentType } from '../Cards/ListingComponentCard/ListingComponentCard';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this backwards relative import make it a little hellish to refactor, you can add a shortcut for @/components (I prefer @/components over @components to differentiate from npm libraries) in the .tsconfig file

https://stackoverflow.com/questions/43281741/how-can-i-use-paths-in-tsconfig-json

@mari1912 mari1912 force-pushed the feat/add-listing-component branch from 431b610 to 5b30274 Compare July 10, 2024 16:56
mari1912 added 4 commits July 10, 2024 14:02
- add base card
- add listing card component
- add listing card component to storybook
@mari1912 mari1912 force-pushed the feat/add-listing-component branch from 5b30274 to 60d0ed5 Compare July 10, 2024 17:37
@mari1912 mari1912 merged commit f949ebf into main Jul 10, 2024
4 checks passed
@mari1912 mari1912 deleted the feat/add-listing-component branch July 10, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Error Warning Listing component
3 participants