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 2 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
26 changes: 26 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,26 @@
import { Meta, StoryObj } from '@storybook/react';
import { fn } from '@storybook/test';
Copy link
Contributor

Choose a reason for hiding this comment

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

Checar si la dependencia import { fn } from '@storybook/test'; esta en uso, si no, quitarla.

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="bg-white text-aci-red text-left px-5 py-1 rounded-xl shadow-lg text-text font-bold">
Copy link
Contributor

Choose a reason for hiding this comment

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

agregar w-full para que tome el width total del componente padre en el que lo pongamos.

{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 @@ -3,3 +3,4 @@ export { Icon } from './Icon';
export { Button } from './Button';
export { ItemSubitem } from './ItemSubitem';
export { CompleteButton } from './CompleteButton';
export { ErrorCard } from './ErrorCard';
Loading