Skip to content

Commit 63ba7c5

Browse files
committed
docs: add <Callout> component
1 parent e9d413c commit 63ba7c5

File tree

10 files changed

+87
-29
lines changed

10 files changed

+87
-29
lines changed

packages/docs/.vuepress/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export default defineUserConfig({
6969
tocPlugin({}),
7070
registerComponentsPlugin({
7171
components: {
72+
Callout: path.resolve(__dirname, './theme-coreui/src/client/components/Callout.vue'),
7273
ScssDocs: path.resolve(__dirname, './theme-coreui/src/client/components/ScssDocs.vue'),
7374
},
7475
}),
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<template>
2+
<div :class="class">
3+
<h5 v-if="title">{{ title }}</h5>
4+
<slot></slot>
5+
</div>
6+
</template>
7+
8+
<script lang="ts">
9+
import { defineComponent } from 'vue'
10+
export default defineComponent({
11+
name: 'Callout',
12+
props: {
13+
color: String,
14+
title: String,
15+
},
16+
setup(props) {
17+
return {
18+
class: [
19+
'docs-callout',
20+
{
21+
[`docs-callout-${props.color}`]: props.color,
22+
}
23+
],
24+
color: props.color,
25+
title: props.title,
26+
}
27+
},
28+
})
29+
</script>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//
2+
// Callouts
3+
//
4+
5+
.docs-callout {
6+
--#{$prefix}link-color-rgb: var(--cd-callout-link);
7+
--#{$prefix}code-color: var(--cd-callout-code-color);
8+
9+
padding: 1.25rem;
10+
margin-top: 1.25rem;
11+
margin-bottom: 1.25rem;
12+
background-color: var(--cd-callout-bg, var(--cui-gray-100));
13+
border-left: .25rem solid var(--cd-callout-border, var(--cui-gray-300));
14+
15+
h4 {
16+
margin-bottom: .25rem;
17+
}
18+
19+
> :last-child {
20+
margin-bottom: 0;
21+
}
22+
23+
+ .docs-callout {
24+
margin-top: -.25rem;
25+
}
26+
27+
.highlight {
28+
background-color: rgba($black, .05);
29+
}
30+
}
31+
32+
// Variations
33+
@each $variant in $cd-callout-variants {
34+
.docs-callout-#{$variant} {
35+
--cd-callout-color: var(--cui-#{$variant}-text-emphasis);
36+
--cd-callout-bg: rgba(var(--cui-#{$variant}-rgb), .1);
37+
--cd-callout-border: var(--cui-#{$variant});
38+
}
39+
}

packages/docs/.vuepress/theme-coreui/src/client/styles/index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
@import "ads";
77
@import "anchor";
8+
@import "callouts";
89
@import "component-examples";
910
@import "footer";
1011
@import "layout";

packages/docs/components/button.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,9 @@ CoreUI includes a bunch of predefined buttons components, each serving its own s
3232
<CButton color="link">Link</CButton>
3333
```
3434

35-
<div class="callout callout-info">
36-
<h5>Conveying meaning to assistive technologies</h5>
37-
<p>
38-
Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the `.visually-hidden` class.
39-
</p>
40-
</div>
35+
<Callout color="info" title="Conveying meaning to assistive technologies">
36+
Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the <code>.visually-hidden</code> class.
37+
</Callout>
4138

4239
## Disable text wrapping
4340

@@ -115,7 +112,7 @@ If you need a ghost variant of button, set `variant="ghost"` prop to remove all
115112
```
116113

117114

118-
<CCallout color="info">Some of the button styles use a relatively light foreground color, and should only be used on a dark background in order to have sufficient contrast.</CCallout>
115+
<Callout color="info">Some of the button styles use a relatively light foreground color, and should only be used on a dark background in order to have sufficient contrast.</Callout>
119116

120117
## Sizes
121118

packages/docs/components/card.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -780,12 +780,9 @@ Use `color` property to change the appearance of a card.
780780
</template>
781781
```
782782

783-
<CCallout color="info">
784-
<h5>Conveying meaning to assistive technologies</h5>
785-
<p>
786-
Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the `.visually-hidden` class.
787-
</p>
788-
</CCallout>
783+
<Callout color="info" title="Conveying meaning to assistive technologies">
784+
Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the <code>.visually-hidden</code> class.
785+
</Callout>
789786

790787
### Border
791788

packages/docs/components/dropdown.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,9 @@ And putting it to use in a navbar:
292292

293293
## Directions
294294

295-
<CCallout color="info">
296-
<h4>RTL</h4>
297-
<p>
298-
Directions are mirrored when using CoreUI in RTL, meaning `.dropstart` will appear on the right side.
299-
</p>
300-
</CCallout>
295+
<Callout color="info" title="RTL">
296+
Directions are mirrored when using CoreUI in RTL, meaning `.dropstart` will appear on the right side.
297+
</Callout>
301298

302299
### Centered
303300

packages/docs/components/list-group.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,9 @@ Contextual classes also work with `<a>`s or `<button>`s. Note the addition of th
194194
</CListGroup>
195195
```
196196

197-
<CCallout color="info">
198-
<h5>Conveying meaning to assistive technologies</h5>
199-
<p>
200-
Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the `.visually-hidden` class.
201-
</p>
202-
</CCallout>
197+
<Callout color="info" title="Conveying meaning to assistive technologies">
198+
Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the <code>.visually-hidden</code> class.
199+
</Callout>
203200

204201
## With badges
205202

packages/docs/components/placeholder.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ We apply additional styling to `CButton`s via `::before` to ensure the `height`
100100
<CButton v-c-placeholder="{xs: 4}" color="primary" aria-hidden="true" disabled href="#" tabindex="-1"></CButton>
101101
```
102102

103-
<CCallout class="mb-4" color="info">
103+
<Callout color="info">
104104
The use of <code>aria-hidden="true"</code> only indicates that the element should be hidden to screen readers. The <strong>loading</strong> behavior of the placeholder depends on how authors will actually use the placeholder styles, how they plan to update things, etc. Some JavaScript code may be needed to *swap* the state of the placeholder and inform AT users of the update.
105-
</CCallout>
105+
</Callout>
106106

107107
### Width
108108

packages/docs/layout/breakpoints.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ These mixins take those declared breakpoints, subtract `.02px` from them, and us
171171
// No media query since the xxl breakpoint has no upper bound on its width
172172
```
173173

174-
<CCallout color="warning">
174+
<Callout color="warning">
175175
<strong>Why subtract .02px?</strong> Browsers don’t currently support <a href="https://www.w3.org/TR/mediaqueries-4/#range-context">range context queries</a>, so we work around the limitations of <a href="https://www.w3.org/TR/mediaqueries-4/#mq-min-max"><code>min-</code> and <code>max-</code> prefixes</a> and viewports with fractional widths (which can occur under certain conditions on high-dpi devices, for instance) by using values with higher precision.
176-
</CCallout>
176+
</Callout>
177177

178178
### Single breakpoint
179179

0 commit comments

Comments
 (0)