aboutsummaryrefslogtreecommitdiff
path: root/examples/docs/src/components/Note.astro
blob: c57ede3a00b16b204d63756ae970a2301ca796e2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
export interface Props {
  title: string;
  type?: 'tip' | 'warning' | 'error'
}
const { type = 'tip', title } = Astro.props;
---

<aside class={`note type-${type}`}>
  {title && <label>{title}</label>}
  <slot />
</aside>

<style>
  .note {
    --padding-block: 1rem;
    --padding-inline: 1.25rem;

    display: flex;
    flex-direction: column;

    padding: var(--padding-block) var(--padding-inline);
    margin-left: calc(var(--padding-inline) * -1);
    margin-right: calc(var(--padding-inline) * -1);
    
    background: var(--theme-bg-offset);
    border-left: calc(var(--padding-inline) / 2) solid var(--color);
    border-radius: 0;
  }

  .note label {
    font-weight: 500;
    color: var(--color);
  }

  /* .note :global(a) {
    color: var(--color);
  } */

  .note.type-tip {
    --color: var(--color-green);
    --color-rgb: var(--color-green-rgb);
  }
  .note.type-warning {
    --color: var(--color-yellow);
    --color-rgb: var(--color-yellow-rgb);
  }
  .note.type-error {
    --color: var(--color-red);
    --color-rgb: var(--color-red-rgb);
  }
</style>