feat(tools): export Alertprops if needed for consumption (#49236)

Co-authored-by: Ahmad Abdolsaheb <ahmad.abdolsaheb@gmail.com>
This commit is contained in:
Muhammed Mustafa
2023-03-15 15:27:07 +02:00
committed by GitHub
parent e64bac9a3f
commit ea83d87869
2 changed files with 7 additions and 6 deletions

View File

@@ -2,13 +2,13 @@ import React from 'react';
type AlertVariant = 'success' | 'info' | 'warning' | 'danger';
export interface AlertProps {
export type AlertProps = {
children: React.ReactNode;
className?: string;
variant: AlertVariant;
}
};
const variantClasses: Record<AlertVariant, string> = {
const variantClasses = {
success: 'text-green-700 bg-green-50 border-green-100',
info: 'text-blue-700 bg-blue-50 border-blue-100',
warning: 'text-yellow-700 bg-yellow-50 border-yellow-100',
@@ -20,11 +20,11 @@ const variantClasses: Record<AlertVariant, string> = {
*
* `Alert` is not dismissable.
*/
export function Alert({
export const Alert = ({
children,
className,
variant
}: AlertProps): JSX.Element {
}: AlertProps): JSX.Element => {
const variantClass = variantClasses[variant];
const classes = [
@@ -38,4 +38,4 @@ export function Alert({
{children}
</div>
);
}
};

View File

@@ -1 +1,2 @@
export { Alert } from './alert';
export type { AlertProps } from './alert';