Skip to content

Commit 5945fa3

Browse files
committed
feat: update the docs
1 parent f22ad6e commit 5945fa3

9 files changed

Lines changed: 135 additions & 115 deletions

File tree

docs/.vitepress/config.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ export default defineConfig({
77
description: "A NPM package to transpose and manage chord charts for music",
88
themeConfig: {
99
// https://vitepress.dev/reference/default-theme-config
10-
nav: [
11-
{ text: "Home", link: "/" },
12-
{ text: "Quickstart", link: "/quickstart" },
13-
],
10+
nav: [{ text: "Demo", link: "/" }],
1411
socialLinks: [{ icon: "github", link: "https://github.com/hrgui/chord-charts" }],
1512
},
1613
});

docs/.vitepress/theme/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import DefaultTheme from "vitepress/theme";
2+
import "./style.css";
3+
export default DefaultTheme;

docs/.vitepress/theme/style.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
5+
select {
6+
--webkit-appearance: auto;
7+
--moz-appearance: auto;
8+
appearance: auto;
9+
}

docs/bun.lockb

40.5 KB
Binary file not shown.

docs/index.md

Lines changed: 98 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,100 @@
11
---
2-
# https://vitepress.dev/reference/default-theme-home-page
3-
layout: home
4-
5-
hero:
6-
name: "Chord Charts"
7-
text: "A NPM package to transpose and manage chord charts for music"
8-
actions:
9-
- theme: alt
10-
text: Quickstart
11-
link: /quickstart
2+
outline: deep
3+
sidebar: false
124
---
5+
6+
::: code-group
7+
8+
```sh [npm]
9+
$ npm add -D @hrgui/chord-charts
10+
```
11+
12+
```sh [pnpm]
13+
$ pnpm add -D @hrgui/chord-charts
14+
```
15+
16+
```sh [yarn]
17+
$ yarn add -D @hrgui/chord-charts
18+
```
19+
20+
```sh [yarn (pnp)]
21+
$ yarn add -D @hrgui/chord-charts
22+
```
23+
24+
```sh [bun]
25+
$ bun add -D @hrgui/chord-charts
26+
```
27+
28+
:::
29+
30+
Use it in the app in the following way:
31+
32+
```ts
33+
import { transpose } from "@hrgui/chord-charts";
34+
35+
console.log(
36+
transpose(
37+
`
38+
D G D
39+
Amazing Grace, how sweet the sound,
40+
A7
41+
That saved a wretch like me.
42+
D G D
43+
I once was lost, but now im found,
44+
A7 D
45+
Was blind, but now I see.
46+
`,
47+
"D",
48+
"C",
49+
),
50+
);
51+
```
52+
53+
<script setup>
54+
import { ref, useTemplateRef, watch } from 'vue'
55+
56+
import { transpose, keys } from "@hrgui/chord-charts";
57+
58+
59+
const count = ref(0)
60+
const previousKey = ref('D')
61+
const currentKey = ref('D')
62+
63+
const text = ref(`
64+
D G D
65+
Amazing Grace, how sweet the sound,
66+
A7
67+
That saved a wretch like me.
68+
D G D
69+
I once was lost, but now im found,
70+
A7 D
71+
Was blind, but now I see.
72+
`);
73+
74+
75+
function transposeChordChart(e) {
76+
text.value = transpose(text.value, previousKey.value, e.target.value);
77+
previousKey.value = e.target.value;
78+
}
79+
80+
</script>
81+
82+
## Working Example
83+
84+
<select v-model="currentKey" class="border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 mb-2" @change="transposeChordChart">
85+
86+
<option v-for="key in keys" :value="key.name">{{key.name}}</option>
87+
</select>
88+
89+
<div>
90+
91+
<textarea v-model="text" class="chord-chart rounded" cols="40" rows="10">
92+
</textarea>
93+
</div>
94+
95+
<style module>
96+
.button {
97+
color: red;
98+
font-weight: bold;
99+
}
100+
</style>

docs/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"devDependencies": {
66
"@hrgui/chord-charts": "latest",
77
"@types/bun": "latest",
8+
"autoprefixer": "^10.4.20",
9+
"postcss": "^8.5.3",
10+
"tailwindcss": "3",
811
"vitepress": "^1.6.3"
912
},
1013
"peerDependencies": {

docs/postcss.config.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/** @type {import('postcss-load-config').Config} */
2+
export default {
3+
plugins: {
4+
tailwindcss: {},
5+
autoprefixer: {},
6+
},
7+
};

docs/quickstart.md

Lines changed: 0 additions & 101 deletions
This file was deleted.

docs/tailwind.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/** @type {import('tailwindcss').Config} */
2+
export default {
3+
content: [
4+
"./**/*.md",
5+
"./*.md",
6+
"./.vitepress/theme/**/*.{js,ts,vue}",
7+
"./.vitepress/**/*.{js,ts,vue}",
8+
"./docs/**/*.md",
9+
],
10+
theme: {
11+
extend: {},
12+
},
13+
plugins: [],
14+
};

0 commit comments

Comments
 (0)