Skip to content

Commit

Permalink
Fix for passing build & lint test
Browse files Browse the repository at this point in the history
  • Loading branch information
ser888gio committed Aug 20, 2024
1 parent b4ec5cf commit 259c26d
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 46 deletions.
43 changes: 21 additions & 22 deletions apps/design-system/stories/badge.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
import { Badge } from "../../../packages/design-system/src/badge";
import { Meta, StoryObj } from '@storybook/react';
import { Badge } from "../../../packages/design-system/src/badge";
import { Meta, StoryObj } from "@storybook/react";

export default {

title: 'Components/Badge',
title: "Components/Badge",
component: Badge,
argTypes: {
color: { control: 'color' },
icon: { control: 'boolean' },
color: { control: "color" },
icon: { control: "boolean" },
variant: {
control: { type: 'select', options: ['neutral', 'primary', 'secondary'] },
control: { type: "select", options: ["neutral", "primary", "secondary"] },
},
},
tags: ['autodocs'],
tags: ["autodocs"],
} as Meta;

type Story = StoryObj<typeof Badge>;
type Story = StoryObj<typeof Badge>;

export const Neutral : Story = {
export const Neutral: Story = {
args: {
icon: false,
variant: 'neutral',
children: 'Label',
variant: "neutral",
children: "Label",
},
};

export const Primary : Story = {
args : {
export const Primary: Story = {
args: {
icon: true,
variant: 'primary',
children: 'Label',
}
variant: "primary",
children: "Label",
},
};

export const Secondary : Story = {
args : {
export const Secondary: Story = {
args: {
icon: false,
variant: 'secondary',
children: 'Label',
}
variant: "secondary",
children: "Label",
},
};
85 changes: 84 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
"dev": "turbo dev",
"format": "turbo format",
"format:fix": "turbo format:fix",
"lint": "turbo lint"
"lint": "turbo lint",
"lint-prettier": "check-prettier"
},
"devDependencies": {
"@repo/eslint-config": "*",
"@repo/typescript-config": "*",
"prettier": "^3.2.5",
"check-prettier": "^1.0.3",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.5",
"turbo": "^2.0.6"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/design-system/src/Badge/BadgeStarIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ function BadgeStarIcon() {
);
}

export default BadgeStarIcon;
export default BadgeStarIcon;
44 changes: 24 additions & 20 deletions packages/design-system/src/badge.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
import React from 'react';
import BadgeStarIcon from "./Badge/BadgeStarIcon"
import React from "react";
import BadgeStarIcon from "./Badge/BadgeStarIcon";

export interface BadgeProps {
icon?: boolean;
variant?: 'neutral' | 'secondary' | 'primary';
variant?: "neutral" | "secondary" | "primary";
children: React.ReactNode;
}

const Badge: React.FC<BadgeProps> = ({ icon = false, variant = 'primary', children }) => {
const showIcon = icon || variant === 'primary';
const neutralVariant = variant === 'primary' || variant === 'neutral'

const Badge: React.FC<BadgeProps> = ({
icon = false,
variant = "primary",
children,
}) => {
const showIcon = icon || variant === "primary";
const neutralVariant = variant === "primary" || variant === "neutral";

return (
<div className={
`k1-flex k1-flex-row k1-justify-center k1-items-center rounded-[0.375rem] px-[0.5rem] py-[0.25rem] k1-gap-1 m-0 font-bold uppercase relative ${showIcon ? 'k1-w-[4.5rem]' : 'k1-w-[3.125rem]'} ${showIcon ? 'k1-h-[1.625rem]' : 'k1-h-[1.5rem]'}`
}>
{showIcon && <div className="k1-inline-block k1-items-center"><BadgeStarIcon/></div>}
<div className = {
`flex text-[0.625rem] font-bold leading-[1.125rem] k1-border-hidden k1-outline-none w-[2.125rem] h-[1.125rem] k1-items-center k1-justify-center k1-inline-block
${neutralVariant ? 'k1-text-[#565252]' : 'k1-text-[#821414]'}
${neutralVariant ? 'bg-[#FFF4F5]' : 'bg-[#F8F7F7]'}`
}
>
<div
className={`k1-flex k1-flex-row k1-justify-center k1-items-center rounded-[0.375rem] px-[0.5rem] py-[0.25rem] k1-gap-1 m-0 font-bold uppercase relative ${showIcon ? "k1-w-[4.5rem]" : "k1-w-[3.125rem]"} ${showIcon ? "k1-h-[1.625rem]" : "k1-h-[1.5rem]"}`}
>
{showIcon && (
<div className="k1-inline-block k1-items-center">
<BadgeStarIcon />
</div>
)}
<div
className={`flex text-[0.625rem] font-bold leading-[1.125rem] k1-border-hidden k1-outline-none w-[2.125rem] h-[1.125rem] k1-items-center k1-justify-center k1-inline-block
${neutralVariant ? "k1-text-[#565252]" : "k1-text-[#821414]"}
${neutralVariant ? "bg-[#FFF4F5]" : "bg-[#F8F7F7]"}`}
>
{children}
</div>
</div>
);
};

export { Badge };



0 comments on commit 259c26d

Please sign in to comment.