|
| 1 | +<!-- |
| 2 | + - SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors |
| 3 | + - SPDX-License-Identifier: AGPL-3.0-or-later |
| 4 | + - |
| 5 | + - A tinted, left-bordered box that lifts a tip, note, privacy point or warning |
| 6 | + - out of the surrounding prose. Theme-aware via color-mix. |
| 7 | +--> |
| 8 | +<template> |
| 9 | + <div class="callout" :class="`callout--${type}`" role="note"> |
| 10 | + <span class="callout__icon" aria-hidden="true">{{ icon }}</span> |
| 11 | + <div class="callout__body"> |
| 12 | + <slot /> |
| 13 | + </div> |
| 14 | + </div> |
| 15 | +</template> |
| 16 | + |
| 17 | +<script> |
| 18 | +const ICONS = { tip: '💡', note: 'ℹ️', privacy: '🔒', warning: '⚠️' } |
| 19 | +
|
| 20 | +export default { |
| 21 | + name: 'Callout', |
| 22 | + props: { |
| 23 | + type: { |
| 24 | + type: String, |
| 25 | + default: 'note', |
| 26 | + validator: (v) => ['tip', 'note', 'privacy', 'warning'].includes(v), |
| 27 | + }, |
| 28 | + }, |
| 29 | +
|
| 30 | + computed: { |
| 31 | + icon() { |
| 32 | + return ICONS[this.type] || ICONS.note |
| 33 | + }, |
| 34 | + }, |
| 35 | +} |
| 36 | +</script> |
| 37 | + |
| 38 | +<style scoped lang="scss"> |
| 39 | +.callout { |
| 40 | + --c: var(--color-primary-element); |
| 41 | + display: flex; |
| 42 | + gap: 12px; |
| 43 | + align-items: flex-start; |
| 44 | + max-width: 720px; |
| 45 | + margin: 16px 0; |
| 46 | + padding: 12px 16px; |
| 47 | + border-radius: var(--border-radius-large, 12px); |
| 48 | + border-inline-start: 4px solid var(--c); |
| 49 | + background: color-mix(in srgb, var(--c) 11%, var(--color-main-background)); |
| 50 | +
|
| 51 | + &__icon { |
| 52 | + font-size: 1.15rem; |
| 53 | + line-height: 1.5; |
| 54 | + } |
| 55 | +
|
| 56 | + &__body { |
| 57 | + line-height: 1.55; |
| 58 | +
|
| 59 | + :deep(p) { margin: 0 0 6px; } |
| 60 | + :deep(p:last-child) { margin: 0; } |
| 61 | + :deep(strong) { font-weight: 600; } |
| 62 | + } |
| 63 | +
|
| 64 | + &--tip { --c: var(--color-success, #4caf50); } |
| 65 | + &--note { --c: var(--color-primary-element); } |
| 66 | + &--privacy { --c: #7d5ba6; } |
| 67 | + &--warning { --c: var(--color-warning, #c98a1e); } |
| 68 | +} |
| 69 | +</style> |
0 commit comments