-
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.
* refactor: rename listTitle to label for clarity * feat add externalLink icon
- Loading branch information
1 parent
430f4f5
commit 6074731
Showing
11 changed files
with
131 additions
and
4 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Canvas, Meta, ArgTypes } from '@storybook/blocks'; | ||
|
||
import * as ModelCardStories from './ModelCard.stories'; | ||
|
||
<Meta of={ModelCardStories} /> | ||
|
||
# Model Card | ||
|
||
<Canvas of={ModelCardStories.Default} /> | ||
|
||
### Props Table | ||
|
||
<ArgTypes /> |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import ModelCard from "."; | ||
|
||
const meta: Meta<typeof ModelCard> = { | ||
title: "Components/Model Card", | ||
component: ModelCard, | ||
decorators: [ | ||
(Story) => ( | ||
<main className="container"> | ||
<Story /> | ||
</main> | ||
), | ||
], | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof ModelCard>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
icon: "/models/mistral.webp", | ||
modelAuthor: "mistralai", | ||
modelName: "Mistral-7B-v0.1", | ||
externalLink: "https://huggingface.co/mistralai/Mistral-7B-v0.1", | ||
}, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { FC } from "react"; | ||
|
||
interface ModelCardProps { | ||
/** Image url for model icon */ | ||
icon: string; | ||
/** Model modelAuthor */ | ||
modelAuthor: string; | ||
/** Model name */ | ||
modelName: string; | ||
/** External link to model */ | ||
externalLink?: string; | ||
} | ||
|
||
const ModelCard: FC<ModelCardProps> = ({ | ||
icon, | ||
modelAuthor, | ||
modelName, | ||
externalLink, | ||
}) => ( | ||
<div className="card model-card"> | ||
<div className="info"> | ||
<img className="icon" src={icon} alt={`${modelAuthor} icon`} /> | ||
<p> | ||
<span>{modelAuthor}</span>/<span>{modelName}</span> | ||
</p> | ||
</div> | ||
{externalLink && ( | ||
<a href={externalLink} target="_blank"> | ||
<img src="/icons/external-link.svg" alt="Follow link" /> | ||
</a> | ||
)} | ||
</div> | ||
); | ||
|
||
export default ModelCard; |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import ModelCard from "./ModelCard"; | ||
export default ModelCard; |
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
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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.card { | ||
@apply justify-between max-w-[700px] bg-gray-50 border border-gray-300 rounded px-6 py-4 dark:bg-gray-900 dark:border-gray-600; | ||
&, | ||
.info { | ||
@apply flex items-center; | ||
} | ||
.info { | ||
@apply gap-3; | ||
} | ||
&.model-card { | ||
.icon { | ||
@apply h-7 w-7 rounded-full border border-gray-300 p-[3px] dark:border-gray-600; | ||
} | ||
p { | ||
@apply flex; | ||
} | ||
p > span { | ||
&:first-child { | ||
@apply text-gray-600 font-medium dark:text-gray-300 mr-1; | ||
} | ||
&:last-child { | ||
@apply text-black-600 font-semibold dark:text-gray-100 ml-1; | ||
} | ||
} | ||
} | ||
a { | ||
@apply m-[-14px] p-[14px]; | ||
img { | ||
@apply transition-filter dark:invert-100 brightness-0 contrast-[25%]; | ||
} | ||
&:hover, | ||
&:focus-visible { | ||
img { | ||
@apply brightness-0 contrast-100; | ||
} | ||
} | ||
} | ||
} |
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
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