diff --git a/src/LoginCard.tsx b/src/LoginCard.tsx index 60e010e..d3ef0c8 100644 --- a/src/LoginCard.tsx +++ b/src/LoginCard.tsx @@ -1,5 +1,6 @@ import { useState } from 'react' import { ChipGroup } from './Chip' +import BaseCard from './shared/primitives/BaseCard' // import { ProgressBar } from './shared/primitives/Progressbar' function LoginCard() { @@ -11,7 +12,10 @@ function LoginCard() { return (
-
+ { @@ -95,7 +99,7 @@ function LoginCard() {

{/* */} -
+
) } diff --git a/src/layouts/AdminLayout.tsx b/src/layouts/AdminLayout.tsx index dab3b6d..98494a5 100644 --- a/src/layouts/AdminLayout.tsx +++ b/src/layouts/AdminLayout.tsx @@ -23,131 +23,6 @@ const AdminLayout = () => { const [activeItem, setActiveItem] = useState('Queue') return ( - //
- // - - // {/* Sidebar */} - // - //
- //
- //
- - //
- // - //
- //
- //
@@ -253,7 +128,7 @@ const AdminLayout = () => { actionsSlot={} searchSlot={ } diff --git a/src/shared/composites/Topbar/Topbar.stories.tsx b/src/shared/composites/Topbar/Topbar.stories.tsx index 413a380..337a260 100644 --- a/src/shared/composites/Topbar/Topbar.stories.tsx +++ b/src/shared/composites/Topbar/Topbar.stories.tsx @@ -46,7 +46,7 @@ export const WithSearch: Story = {
), diff --git a/src/shared/composites/Topbar/Topbar.tsx b/src/shared/composites/Topbar/Topbar.tsx index 5f6e0b1..334d657 100644 --- a/src/shared/composites/Topbar/Topbar.tsx +++ b/src/shared/composites/Topbar/Topbar.tsx @@ -27,7 +27,7 @@ export function Topbar({ }: TopbarProps) { return (
{/* Left */}
diff --git a/src/shared/primitives/BaseCard/BaseCard.stories.tsx b/src/shared/primitives/BaseCard/BaseCard.stories.tsx new file mode 100644 index 0000000..8537c29 --- /dev/null +++ b/src/shared/primitives/BaseCard/BaseCard.stories.tsx @@ -0,0 +1,102 @@ +import type { Meta, StoryObj } from '@storybook/react-vite' + +import { BaseCard } from './BaseCard' + +const meta = { + title: 'Shared/Primitives/BaseCard', + + component: BaseCard, + + tags: ['autodocs'], +} satisfies Meta + +export default meta + +type Story = StoryObj + +export const Default: Story = { + args: { + children: 'Default card content', + }, +} + +export const Danger: Story = { + args: { + variant: 'danger', + + children: 'Danger card content', + }, +} + +export const Warning: Story = { + args: { + variant: 'warning', + + children: 'Warning card content', + }, +} + +export const Success: Story = { + args: { + variant: 'success', + + children: 'Success card content', + }, +} + +export const Info: Story = { + args: { + variant: 'info', + + children: 'Info card content', + }, +} + +export const PaddingSmall: Story = { + args: { + padding: 'sm', + + children: 'Small padding', + }, +} + +export const PaddingMedium: Story = { + args: { + padding: 'md', + + children: 'Medium padding', + }, +} + +export const PaddingLarge: Story = { + args: { + padding: 'lg', + + children: 'Large padding', + }, +} + +export const NoPadding: Story = { + args: { + padding: 'none', + + children:
Parent controls spacing
, + }, +} + +export const NestedBaseCards: Story = { + args: { + children: '', + }, + render: () => ( + +
+

Parent card

+ + + Nested card + +
+
+ ), +} diff --git a/src/shared/primitives/BaseCard/BaseCard.tsx b/src/shared/primitives/BaseCard/BaseCard.tsx new file mode 100644 index 0000000..951b195 --- /dev/null +++ b/src/shared/primitives/BaseCard/BaseCard.tsx @@ -0,0 +1,97 @@ +import React from 'react' + +import { cva, type VariantProps } from 'class-variance-authority' + +const baseCardStyles = cva( + ` + w-full + rounded-xl + border + transition-colors + `, + { + variants: { + variant: { + default: ` + border-border-secondary + bg-bg-primary + `, + + danger: ` + border-border-danger + bg-bg-danger + `, + + warning: ` + border-border-warning + bg-bg-warning + `, + + success: ` + border-border-success + bg-bg-success + `, + + info: ` + border-border-info + bg-bg-info + `, + }, + + padding: { + none: '', + + sm: 'p-3', + + md: 'p-4', + + lg: 'p-6', + }, + }, + + defaultVariants: { + variant: 'default', + + padding: 'md', + }, + } +) + +export interface BaseCardProps + extends React.HTMLAttributes, VariantProps { + children: React.ReactNode + + testId?: string +} + +export function BaseCard({ + children, + + variant, + + padding, + + className = '', + + testId, + + ...props +}: BaseCardProps) { + return ( +
+ {children} +
+ ) +} + +export default BaseCard diff --git a/src/shared/primitives/BaseCard/index.ts b/src/shared/primitives/BaseCard/index.ts new file mode 100644 index 0000000..1516ef0 --- /dev/null +++ b/src/shared/primitives/BaseCard/index.ts @@ -0,0 +1,3 @@ +export * from './BaseCard' + +export { default } from './BaseCard'