-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update : adjust stories and test with new props
- Loading branch information
1 parent
8133827
commit f8fc300
Showing
2 changed files
with
98 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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,39 +1,127 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import Table from "./Table"; | ||
|
||
// Define meta for Table component with default args | ||
const meta: Meta<typeof Table> = { | ||
component: Table, | ||
args: { | ||
problems: [ | ||
{ | ||
id: 1, | ||
title: "Two Sum", | ||
difficulty: "Easy", | ||
}, | ||
{ | ||
id: 128, | ||
title: "Longest Consecutive Sequence", | ||
difficulty: "Med.", | ||
}, | ||
{ | ||
id: 133, | ||
title: "Clone Graph", | ||
difficulty: "Med.", | ||
}, | ||
{ | ||
id: 295, | ||
title: "Find Median From Data Stream", | ||
difficulty: "Hard", | ||
}, | ||
], | ||
solvedProblems: [ | ||
{ | ||
id: 1, | ||
title: "Two Sum", | ||
difficulty: "Easy", | ||
}, | ||
{ | ||
id: 133, | ||
title: "Clone Graph", | ||
difficulty: "Med.", | ||
}, | ||
], // Default solved problems for this example | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default: StoryObj<typeof Table> = { | ||
// Default story (uses default args) | ||
export const Default: StoryObj<typeof Table> = {}; | ||
|
||
// Story for all problems marked as solved | ||
export const AllCompleted: StoryObj<typeof Table> = { | ||
args: { | ||
problems: [ | ||
{ | ||
id: 1, | ||
title: "Two Sum", | ||
difficulty: "Easy", | ||
}, | ||
{ | ||
id: 128, | ||
title: "Longest Consecutive Sequence", | ||
difficulty: "Med.", | ||
}, | ||
{ | ||
id: 133, | ||
title: "Clone Graph", | ||
difficulty: "Med.", | ||
}, | ||
{ | ||
id: 295, | ||
title: "Find Median From Data Stream", | ||
difficulty: "Hard", | ||
}, | ||
], | ||
solvedProblems: [ | ||
{ | ||
id: 1, | ||
title: "Two Sum", | ||
difficulty: "Easy", | ||
}, | ||
{ | ||
id: 128, | ||
title: "Longest Consecutive Sequence", | ||
difficulty: "Med.", | ||
}, | ||
{ | ||
id: 133, | ||
title: "Clone Graph", | ||
difficulty: "Med.", | ||
}, | ||
{ | ||
id: 295, | ||
title: "Find Median From Data Stream", | ||
difficulty: "Hard", | ||
}, | ||
], // All problems are solved | ||
}, | ||
}; | ||
|
||
// Story for no problems solved | ||
export const NoCompletedProblems: StoryObj<typeof Table> = { | ||
args: { | ||
problems: [ | ||
{ | ||
id: 1, | ||
title: "Two Sum", | ||
difficulty: "Easy", | ||
completed: true, | ||
}, | ||
{ | ||
id: 128, | ||
title: "Longest Consecutive Sequence", | ||
difficulty: "Med.", | ||
completed: false, | ||
}, | ||
{ | ||
id: 133, | ||
title: "Clone Graph", | ||
difficulty: "Med.", | ||
completed: true, | ||
}, | ||
{ | ||
id: 295, | ||
title: "Find Median From Data Stream", | ||
difficulty: "Hard", | ||
completed: false, | ||
}, | ||
], | ||
solvedProblems: [], // No problems solved | ||
}, | ||
}; |
This file contains 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