|
| 1 | +--- |
| 2 | +import { Icon } from '@astrojs/starlight/components'; |
| 3 | +import { CONTACT_URL } from '../../consts'; |
| 4 | +
|
| 5 | +export type Props = { |
| 6 | + title: string; |
| 7 | + body: string; |
| 8 | + linkLabel?: string; |
| 9 | + href?: string; |
| 10 | +}; |
| 11 | +
|
| 12 | +const DEFAULT_LINK_LABEL = 'Talk to the team'; |
| 13 | +
|
| 14 | +const { title, body, linkLabel = DEFAULT_LINK_LABEL, href = CONTACT_URL } = Astro.props; |
| 15 | +
|
| 16 | +const pagePath = Astro.url.pathname; |
| 17 | +--- |
| 18 | + |
| 19 | +<aside class="help-banner"> |
| 20 | + <div class="help-banner-icon" aria-hidden="true"> |
| 21 | + <Icon name="comment-alt" /> |
| 22 | + </div> |
| 23 | + <div class="help-banner-content"> |
| 24 | + <p class="help-banner-title">{title}</p> |
| 25 | + <p class="help-banner-body">{body}</p> |
| 26 | + <a |
| 27 | + class="help-banner-link" |
| 28 | + href={href} |
| 29 | + target="_blank" |
| 30 | + rel="noopener noreferrer" |
| 31 | + data-umami-event="help-banner-click" |
| 32 | + data-umami-event-page={pagePath} |
| 33 | + > |
| 34 | + {`${linkLabel} →`} |
| 35 | + </a> |
| 36 | + </div> |
| 37 | +</aside> |
| 38 | + |
| 39 | +<style> |
| 40 | + @layer starlight.core { |
| 41 | + .help-banner { |
| 42 | + display: flex; |
| 43 | + align-items: flex-start; |
| 44 | + gap: 1rem; |
| 45 | + margin-top: 3rem; |
| 46 | + padding: 1.25rem 1.5rem; |
| 47 | + border: 1px solid var(--sl-color-gray-5); |
| 48 | + border-radius: 0.5rem; |
| 49 | + background: var(--sl-color-gray-6); |
| 50 | + color: var(--sl-color-gray-2); |
| 51 | + } |
| 52 | + |
| 53 | + .help-banner-icon { |
| 54 | + display: flex; |
| 55 | + align-items: center; |
| 56 | + justify-content: center; |
| 57 | + flex-shrink: 0; |
| 58 | + width: 2rem; |
| 59 | + height: 2rem; |
| 60 | + border-radius: 50%; |
| 61 | + background: var(--sl-color-gray-5); |
| 62 | + color: var(--sl-color-text-accent); |
| 63 | + } |
| 64 | + |
| 65 | + .help-banner-icon :global(svg) { |
| 66 | + width: 1rem; |
| 67 | + height: 1rem; |
| 68 | + } |
| 69 | + |
| 70 | + .help-banner-content { |
| 71 | + display: flex; |
| 72 | + flex-direction: column; |
| 73 | + gap: 0.25rem; |
| 74 | + min-width: 0; |
| 75 | + } |
| 76 | + |
| 77 | + .help-banner-title { |
| 78 | + margin: 0; |
| 79 | + font-size: var(--sl-text-base); |
| 80 | + font-weight: 600; |
| 81 | + color: var(--sl-color-white); |
| 82 | + line-height: 1.4; |
| 83 | + } |
| 84 | + |
| 85 | + .help-banner-body { |
| 86 | + margin: 0; |
| 87 | + font-size: var(--sl-text-sm); |
| 88 | + line-height: 1.6; |
| 89 | + color: var(--sl-color-gray-3); |
| 90 | + } |
| 91 | + |
| 92 | + .help-banner-link { |
| 93 | + margin-top: 0.5rem; |
| 94 | + font-size: var(--sl-text-sm); |
| 95 | + font-weight: 500; |
| 96 | + color: var(--sl-color-text-accent); |
| 97 | + text-decoration: none; |
| 98 | + width: fit-content; |
| 99 | + } |
| 100 | + |
| 101 | + .help-banner-link:hover { |
| 102 | + text-decoration: underline; |
| 103 | + } |
| 104 | + |
| 105 | + @media (max-width: 30em) { |
| 106 | + .help-banner { |
| 107 | + padding: 1rem; |
| 108 | + gap: 0.75rem; |
| 109 | + } |
| 110 | + } |
| 111 | + |
| 112 | + @media print { |
| 113 | + .help-banner { |
| 114 | + display: none; |
| 115 | + } |
| 116 | + } |
| 117 | + } |
| 118 | +</style> |
0 commit comments