Skip to content

Commit

Permalink
migrated Warning
Browse files Browse the repository at this point in the history
  • Loading branch information
devilkiller-ag committed Mar 27, 2024
1 parent 9bfab57 commit d7a889e
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 6 deletions.
25 changes: 19 additions & 6 deletions components/Remember.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import LightBulb from './icons/LightBulb';

interface RememberProps {
title?: string;
className: string;
className?: string;
children: string;
}

Expand All @@ -13,12 +13,25 @@ interface RememberProps {
* @param {string} props.className - Additional classes for the figure
* @param {string} props.children - The content of the remember component
*/
export default function Remember({ title = 'Remember', className, children }: RememberProps) {
export default function Remember({
title = 'Remember',
className = '',
children,
}: RememberProps) {
return (
<div className={`${className} mb-8 mt-4 rounded bg-secondary-100 p-4 text-gray-900`} data-testid='Remember-main'>
<h5 className='mb-4 border-b border-gray-900 pb-2 text-lg' data-testid='Remember-heading'>
<LightBulb className='-mt-0.5 mr-2 inline-block h-8' />
<span className='ml-2 inline-block font-sans font-medium antialiased' data-testid='Remember-title'>
<div
className={`${className} mb-8 mt-4 rounded bg-secondary-100 p-4 text-gray-900`}
data-testid="Remember-main"
>
<h5
className="mb-4 border-b border-gray-900 pb-2 text-lg"
data-testid="Remember-heading"
>
<LightBulb className="-mt-0.5 mr-2 inline-block h-8" />
<span
className="ml-2 inline-block font-sans font-medium antialiased"
data-testid="Remember-title"
>
{title}
</span>
</h5>
Expand Down
34 changes: 34 additions & 0 deletions components/Warning.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import IconExclamation from './icons/Exclamation';

interface WarningProps {
title: string;
className?: string;
description: string;
}

/**
* This component displays a warning component.
* @param {WarningProps} props - The props for the warning component
* @param {string} props.title - The title of the warning component
* @param {string} props.className - Additional classes for the figure
* @param {string} props.description - The content of the warning component
*/
export default function Warning({ className = '', title, description }: WarningProps) {
return (
<div className={`${className} rounded-md bg-yellow-50 p-4`} data-testid='Warning-main'>
<div className='flex'>
<div className='shrink-0'>
<IconExclamation className='size-5' />
</div>
<div className='ml-3'>
<h3 className='text-sm font-medium uppercase leading-5 text-yellow-800' data-testid='Warning-title'>
{title}
</h3>
<div className='mt-2 text-sm leading-5 text-yellow-700' data-testid='Warning-description'>
<p>{description}</p>
</div>
</div>
</div>
</div>
);
}

0 comments on commit d7a889e

Please sign in to comment.