Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions public/icons/external-link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/models/mistral.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/components/Cards/ModelCard/ModelCard.mdx
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 />
28 changes: 28 additions & 0 deletions src/components/Cards/ModelCard/ModelCard.stories.tsx
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",
},
};
35 changes: 35 additions & 0 deletions src/components/Cards/ModelCard/ModelCard.tsx
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;
2 changes: 2 additions & 0 deletions src/components/Cards/ModelCard/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import ModelCard from "./ModelCard";
export default ModelCard;
2 changes: 1 addition & 1 deletion src/components/Select/Select.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Story = StoryObj<typeof Select>;

export const Default: Story = {
args: {
listTitle: "Year",
label: "Year",
listItems: [
{
value: "2024",
Expand Down
10 changes: 7 additions & 3 deletions src/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,21 @@ import {
} from "react-aria-components";

interface listItem {
/** List item value (used for key) */
value: string;
/** List item label */
label: string;
}
interface SelectProps {
listTitle?: string;
/** Select field label */
label?: string;
/** Select field list items */
listItems: listItem[];
}

const Select: FC<SelectProps> = ({ listTitle, listItems }) => (
const Select: FC<SelectProps> = ({ label, listItems }) => (
<ReactAriaSelect className="select" defaultSelectedKey={"2024"}>
{listTitle && <Label>{listTitle}</Label>}
{label && <Label>{label}</Label>}
<Button>
<SelectValue />
<span aria-hidden="true" className="icon">
Expand Down
38 changes: 38 additions & 0 deletions src/styles/components/cards.css
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;
}
}
}
}
1 change: 1 addition & 0 deletions src/styles/main.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import "./global.css";
@import "./components/cards.css";
@import "./components/chat.css";
@import "./components/footer.css";
@import "./components/header.css";
Expand Down
1 change: 1 addition & 0 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const theme: Config = {
"font-size": "font-size",
spacing: "margin, padding, gap",
sizing: "height, width",
filter: "filter",
},
invert: {
"77": ".77",
Expand Down