Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ErrorCard created #46

Merged
merged 4 commits into from
Apr 19, 2024
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
25 changes: 25 additions & 0 deletions src/components/ErrorCard/ErrorCard.stories.tsx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reestructura todo el archivo basándote en components/Button/Button.stories.tsx, ya que faltan muchas etiquetas como parameters, argTypes y tags

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Meta, StoryObj } from '@storybook/react';
import ErrorCard from './ErrorCard';

const meta = {
title: 'Components/ErrorCard',
component: ErrorCard,
parameters: {
layout: 'centered',
},
argTypes: {
title: {
control: 'text',
}
},
tags: ["autodocs"]
}satisfies Meta<typeof ErrorCard>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Primary: Story = {
args: {
title: 'Error fetching training data',
},
}
16 changes: 16 additions & 0 deletions src/components/ErrorCard/ErrorCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";
import { IErrorCard } from "./types";

/**
* An error card that displays the error message
*/

const ErrorCard: React.FC<IErrorCard> = ({ title }) => {
return (
<div className="w-full bg-white text-aci-red text-left px-5 py-1 rounded-xl shadow-lg text-text font-bold">
{title}
</div>
);
};

export default ErrorCard;
1 change: 1 addition & 0 deletions src/components/ErrorCard/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as ErrorCard} from './ErrorCard';
6 changes: 6 additions & 0 deletions src/components/ErrorCard/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface IErrorCard{
/**
* The text prop of the ErrorCard
*/
title: string;
}
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export { InputField } from './InputField';
export { AlertCard } from './AlertCard';
export { ItemSubitem } from './ItemSubitem';
export { CompleteButton } from './CompleteButton';
export { ErrorCard } from './ErrorCard';
export { TrainingCardToggle } from './TrainingCardToggle';
export { InformationBar } from './InformationBar';