Skip to content

Commit a1c9044

Browse files
committed
Vuepress theme with styles to light and dark mode + announcer, skip-to and more
0 parents  commit a1c9044

17 files changed

+12562
-0
lines changed

.eslintrc.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
browser: true,
5+
node: true
6+
},
7+
plugins: [
8+
'vuejs-accessibility'
9+
],
10+
extends: [
11+
'plugin:vue/recommended',
12+
'@vue/standard',
13+
'plugin:vuejs-accessibility/recommended'
14+
],
15+
parserOptions: {
16+
parser: 'babel-eslint'
17+
},
18+
rules: {
19+
'no-console': 'off'
20+
}
21+
}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# vuepress-theme-default-vue-a11y
2+
Vuepress theme for vue-a11y documentation

config/plugins.js

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
const md = require('markdown-it')()
2+
let caption = ''
3+
4+
module.exports = [
5+
[
6+
'vuepress-plugin-code-copy',
7+
{
8+
staticIcon: true,
9+
color: 'currentColor'
10+
}
11+
],
12+
[
13+
'container',
14+
{
15+
type: 'figurecode',
16+
defaultTitle: '',
17+
render: (tokens, idx) => {
18+
const m = tokens[idx].info.trim().match(/^figurecode\s+(.*)$/)
19+
if (tokens[idx].nesting === 1) {
20+
caption = m ? md.utils.escapeHtml(m[1]) : ''
21+
// aria-label for macOS VoiceOver + Chrome
22+
// see more: https://www.scottohara.me/blog/2019/01/21/how-do-you-figure.html
23+
return `
24+
<figure
25+
aria-label="${caption}"
26+
class="figurecode"
27+
>
28+
<div class="figurecode__content">
29+
`
30+
} else {
31+
return `
32+
</div>
33+
<figcaption class="figurecode__caption">
34+
${caption}
35+
</figcaption>
36+
</figure>
37+
`
38+
}
39+
}
40+
}
41+
]
42+
]

docs/.vuepress/config.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module.exports = {
2+
theme: require.resolve('../../'),
3+
title: 'Vue A11y theme',
4+
head: [
5+
['meta', { name: 'theme-color', content: '#fff' }],
6+
],
7+
themeConfig: {
8+
home: false,
9+
repo: 'vue-a11y/vuepress-theme-vue-a11y-docs',
10+
docsDir: 'docs',
11+
docsBranch: 'master',
12+
editLinks: true,
13+
// TODO: Fazer o color mode seja totalmente flexível através daqui e dos locales
14+
colorMode: {},
15+
// TODO: Fazer o skip-to seja totalmente flexível através daqui e dos locales
16+
skipTo: {},
17+
locales: {
18+
'/': {
19+
editLinkText: 'Edit this page on GitHub',
20+
nav: [
21+
{
22+
text: 'Guide',
23+
link: '/guide/'
24+
}
25+
],
26+
sidebar: [
27+
'/',
28+
{
29+
title: 'Guide',
30+
collapsable: false,
31+
children: [
32+
'/guide/'
33+
]
34+
}
35+
]
36+
}
37+
}
38+
}
39+
}

docs/.vuepress/public/logo.png

23.5 KB
Loading

docs/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
home: true
3+
heroImage: /logo.png
4+
heroText: Vue A11y theme
5+
tagline: Vuepress theme for Vue A11y documentations
6+
actionText: Get Started →
7+
actionLink: /guide/
8+
footer: MIT Licensed | With 💖 and Vuepress
9+
---
10+
11+
<div class="features">
12+
<div class="feature">
13+
<h2>Vue a11y packages</h2>
14+
<p>Some text here.</p>
15+
</div>
16+
<div class="feature">
17+
<h2>Some title here</h2>
18+
<p>Some text here.</p>
19+
</div>
20+
<div class="feature">
21+
<h2>Some title here</h2>
22+
<p>Some text here.</p>
23+
</div>
24+
</div>

docs/guide/README.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Test page
2+
3+
::: figurecode my caption
4+
```html
5+
<button aria-label="close" aria-describedby="descriptionClose">X</button>
6+
<div id="descriptionClose" hidden>
7+
Se você cancelar perderá as informações inseridas no campo XXX e será
8+
enviado para a página anterior.
9+
</div>
10+
```
11+
:::
12+
13+
14+
---
15+
16+
``` js{4}
17+
export default {
18+
data () {
19+
return {
20+
msg: 'Highlighted!'
21+
}
22+
}
23+
}
24+
```
25+
26+
---
27+
28+
::: tip
29+
This is a tip
30+
:::
31+
32+
::: warning
33+
This is a warning
34+
:::
35+
36+
::: danger
37+
This is a dangerous warning
38+
:::
39+
40+
::: details
41+
This is a details block, which does not work in IE / Edge
42+
:::
43+
44+
---
45+
46+
| Tables | Are | Cool |
47+
| ------------- |:-------------:| -----:|
48+
| col 3 is | right-aligned | $1600 |
49+
| col 2 is | centered | $12 |
50+
| zebra stripes | are neat | $1 |
51+
| col 3 is | right-aligned | $1600 |
52+
| col 2 is | centered | $12 |
53+
| zebra stripes | are neat | $1 |
54+
55+
---
56+
57+
:tada: :100:
58+
59+
---
60+
61+
::: danger STOP
62+
Danger zone, do not proceed
63+
:::
64+
65+
::: details Click me to view the code
66+
```js
67+
console.log('Hello, VuePress!')
68+
```
69+
:::

enhanceApp.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import VueAnnouncer from '@vue-a11y/announcer'
2+
import VueDarkMode from '@vue-a11y/dark-mode'
3+
import 'a11y-css-reset/combo.css'
4+
import VueSkipTo from 'vue-skip-to'
5+
6+
export default ({ Vue, router, isServer }) => {
7+
if (!isServer) {
8+
Vue.use(VueSkipTo)
9+
Vue.use(VueDarkMode)
10+
Vue.use(VueAnnouncer, {}, router)
11+
}
12+
}

index.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const plugins = require('./config/plugins')
2+
3+
module.exports = {
4+
extend: '@vuepress/theme-default',
5+
plugins
6+
}

layouts/Layout.vue

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<template>
2+
<div>
3+
<VueSkipTo />
4+
<ParentLayout>
5+
<template #sidebar-top>
6+
<VueDarkMode class="btn-color-mode">
7+
<template v-slot="{ mode }">
8+
Color mode: <span data-cy="color-mode">{{ mode }}</span>
9+
</template>
10+
</VueDarkMode>
11+
</template>
12+
<template #page-bottom>
13+
<VueAnnouncer />
14+
</template>
15+
</ParentLayout>
16+
</div>
17+
</template>
18+
19+
<script>
20+
import ParentLayout from '@parent-theme/layouts/Layout.vue'
21+
22+
export default {
23+
components: {
24+
ParentLayout
25+
},
26+
27+
mounted () {
28+
this.setMainId()
29+
},
30+
31+
methods: {
32+
setMainId () {
33+
const main = document.getElementsByTagName('main')
34+
if (main.length) main[0].setAttribute('id', 'main')
35+
}
36+
}
37+
}
38+
</script>
39+
40+
<style lang="stylus" src="../styles/content.styl"></style>
41+
<style lang="stylus" src="../styles/override-components.styl"></style>
42+
<style lang="stylus">
43+
.btn-color-mode
44+
margin-top: 1.5rem
45+
margin-left: 1.5rem
46+
&.vue-dark-mode
47+
border: 2px solid #666
48+
border-radius: 6px
49+
padding: 8px 14px
50+
font-weight: bold
51+
span
52+
text-transform: capitalize
53+
</style>

0 commit comments

Comments
 (0)