aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2025-04-11 16:20:14 +0200
committerAriel Costas Guerrero <ariel@costas.dev>2025-04-11 16:20:14 +0200
commit56f6a63ff90d6ad648b99c2d0eea7dd4cd6f888a (patch)
treeed034997ae42af8be75a4c0fb26e77c241d976cc /src/components
parente3141794b95e534656427fadf0354435c62254d6 (diff)
Use MDX instead of markdown
Diffstat (limited to 'src/components')
-rw-r--r--src/components/Alert.astro57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/components/Alert.astro b/src/components/Alert.astro
new file mode 100644
index 0000000..0cb5fa2
--- /dev/null
+++ b/src/components/Alert.astro
@@ -0,0 +1,57 @@
+---
+import { Icon } from "astro-icon/components";
+
+interface Props {
+ type: "note" | "warning";
+}
+
+const { type } = Astro.props;
+
+const icon = {
+ note: "ph:info",
+ warning: "ph:warning",
+}[type];
+---
+
+<div role="alert" class={type}>
+ <Icon name={icon} />
+ <slot />
+</div>
+
+<style lang="scss" is:global>
+ @use "../../styles/shared.scss" as *;
+
+ div[role="alert"] {
+ display: flex;
+ align-items: center;
+ justify-content: flex-start;
+
+ padding: 1rem;
+ margin-block: 1rem;
+ border-radius: 0.5rem;
+
+ &.note {
+ background-color: $noteBackground;
+ color: $noteText;
+ box-shadow: 0 0 0 1px $noteText;
+ }
+
+ &.warning {
+ background-color: $warningBackground;
+ color: $warningText;
+ box-shadow: 0 0 0 1px $warningText;
+ }
+ }
+
+ div[role="alert"] svg {
+ width: 1.5em;
+ height: 1.5em;
+ margin-inline-end: 0.5rem;
+ color: inherit;
+ vertical-align: middle;
+ }
+
+ div[role="alert"] p {
+ margin-block: 0;
+ }
+</style>