Files
FastGPT/document/components/docs/Alert.tsx
Archer fe7abf22a9 New document (#5299)
* add new doc (#5175)

Co-authored-by: dreamer6680 <146868355@qq.com>

* Test docs (#5235)

* fix: change the page of doc

* chore: add new dependencies, update global styles/layout, optimize docs, add Feishu & GitHub icons, update API examples

* fix: docs/index 404 not found

* Update environment variable names, optimize styles, add new API routes, fix component styles, adjust documentation, and update GitHub and Feishu icons

* update readme

* feat: add a linkfastgpt compontent

* feat: update new doc

* fix:remove unuse page and redirect homepage to docs (#5288)

* fix:remove some unuse doc

* fix: redirect homepage to doc

* git ignore

* fix:navbar to index (#5295)

* sidbar

* fix: navtab unlight (#5298)

* doc

---------

Co-authored-by: dreamer6680 <1468683855@qq.com>
Co-authored-by: dreamer6680 <146868355@qq.com>
2025-07-23 21:35:03 +08:00

36 lines
1.1 KiB
TypeScript

import type { ReactNode } from 'react';
interface AlertProps {
icon: ReactNode;
context: 'success' | 'warning' | 'error' | 'info';
children: ReactNode;
}
export function Alert({ icon, context = 'info', children }: AlertProps) {
const contextStyles = {
success:
'bg-green-50 border-green-200 text-green-700 dark:bg-white/5 dark:border-teal-300 dark:text-gray-200',
warning:
'bg-yellow-50 border-yellow-200 text-yellow-700 dark:dark:bg-white/5 dark:border-indigo-500 dark:text-gray-200',
error:
'bg-red-50 border-red-200 text-red-700 dark:bg-white/5 dark:border-red-800 dark:text-gray-200',
info: 'bg-blue-50 border-blue-200 text-blue-700 dark:bg-white/5 dark:border-blue-400 dark:text-gray-200'
};
return (
<div
className={`
${contextStyles[context]}
p-4 rounded-lg border
flex gap-3 items-baseline
shadow-sm
transition-all duration-200 ease-in-out
hover:shadow-md
`}
>
<div className="text-2xl flex-shrink-0 mt-0.5">{icon}</div>
<div className="space-y-2 text-sm leading-relaxed flex-grow">{children}</div>
</div>
);
}