Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Init admonition component

Joshen Limafe1fdf462a2
diff --git a/apps/temp-docs/components/Admonition.tsx b/apps/temp-docs/components/Admonition.tsx
index e69de29bb2d..50d530128ca 100644
--- a/apps/temp-docs/components/Admonition.tsx
+++ b/apps/temp-docs/components/Admonition.tsx
@@ -0,0 +1,50 @@
+import { FC } from 'react'
+import { IconInfo, IconHelpCircle, IconAlertTriangle } from 'ui'
+
+interface Props {
+ type: 'note' | 'tip' | 'info' | 'caution' | 'danger'
+ children: any
+}
+
+const Admonition: FC<Props> = ({ type = 'note', children }) => {
+ return (
+ <div
+ className={[
+ 'shadow p-4 rounded border-l-[5px] space-y-2',
+ `${
+ type === 'note'
+ ? 'bg-scale-500 border-scale-800'
+ : type === 'info'
+ ? 'bg-blue-500 border-blue-800'
+ : type === 'tip'
+ ? 'bg-brand-500 border-brand-800'
+ : type === 'caution'
+ ? 'bg-yellow-500 border-yellow-800'
+ : type === 'danger'
+ ? 'bg-red-500 border-red-800'
+ : 'bg-scale-500 border-scale-800'
+ }`,
+ ].join(' ')}
+ >
+ <div className="flex items-center space-x-2">
+ {type === 'note' ? (
+ <IconInfo className="text-scale-1200" size={18} strokeWidth={1.5} />
+ ) : type === 'info' ? (
+ <IconInfo className="text-scale-1200" size={18} strokeWidth={1.5} />
+ ) : type === 'tip' ? (
+ <IconHelpCircle className="text-scale-1200" size={18} strokeWidth={1.5} />
+ ) : type === 'caution' ? (
+ <IconAlertTriangle className="text-scale-1200" size={18} strokeWidth={1.5} />
+ ) : type === 'danger' ? (
+ <IconAlertTriangle className="text-scale-1200" size={18} strokeWidth={1.5} />
+ ) : (
+ <IconInfo className="text-scale-1200" size={18} strokeWidth={1.5} />
+ )}
+ <p className="text-base text-scale-1200 uppercase my-0">{type}</p>
+ </div>
+ <div className="admonition-content text-scale-1200 text-base">{children}</div>
+ </div>
+ )
+}
+
+export default Admonition
diff --git a/apps/temp-docs/styles/main.scss b/apps/temp-docs/styles/main.scss
index 7018c21b9f6..97358f02757 100644
--- a/apps/temp-docs/styles/main.scss
+++ b/apps/temp-docs/styles/main.scss
@@ -171,4 +171,8 @@ pre[class*='language-'] {
height: 100%;
border: 0;
}
+}
+
+.admonition-content > p {
+ @apply m-0;
}
\ No newline at end of file