Skip to content

Commit e4b20da

Browse files
committed
chore(vue): Update README
1 parent 13e6dc3 commit e4b20da

File tree

1 file changed

+126
-0
lines changed

1 file changed

+126
-0
lines changed

packages/vue/README.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,127 @@
11
# @discord-message-components/vue
2+
3+
## Installation and usage
4+
5+
![@discord-message-components/vue preview](https://i.imgur.com/ZxsfkHb.png)
6+
7+
```sh
8+
yarn add @discord-message-components/vue
9+
# or npm install @discord-message-components/vue
10+
```
11+
12+
```js
13+
import { createApp } from 'vue'
14+
import { install as DiscordMessageComponents } from '@discord-message-components/vue'
15+
import App from './App.vue'
16+
import '@discord-message-components/vue/styles'
17+
18+
const app = createApp(App)
19+
20+
// Only necessary if you want to provide plugin options
21+
app.use(DiscordMessageComponents, {
22+
profiles: {
23+
sanc: {
24+
author: 'Sanc',
25+
avatar: 'https://i.imgur.com/0TeacfY.png',
26+
roleColor: '#0099ff',
27+
},
28+
},
29+
})
30+
31+
app.mount('#app')
32+
```
33+
34+
```html
35+
<template>
36+
<DiscordMessages>
37+
<DiscordMessage profile="sanc">
38+
Hey, <DiscordMention :highlight="true" /> and <DiscordMention>Dawn</DiscordMention>. Welcome to our server!
39+
<template #reactions>
40+
<DiscordReactions>
41+
<DiscordReaction name="blobreach" image="https://i.imgur.com/DUAI5Pu.png" :count="2" :active="true" />
42+
</DiscordReactions>
43+
</template>
44+
</DiscordMessage>
45+
<DiscordMessage author="Dawn" avatar="red">
46+
Thank you <DiscordMention profile="sanc" />!
47+
</DiscordMessage>
48+
<DiscordMessage>
49+
Thanks! How's it going?
50+
</DiscordMessage>
51+
<DiscordMessage :bot="true" author="Rinon" avatar="https://i.imgur.com/axQ9wJl.png" role-color="violet">
52+
<template #interactions>
53+
<DiscordInteraction profile="sanc" :command="true">8ball</DiscordInteraction>
54+
</template>
55+
<DiscordMarkdown>
56+
**Question**: How am I doing today?
57+
{{ '\n' }}
58+
**Answer**: Yes.
59+
</DiscordMarkdown>
60+
</DiscordMessage>
61+
</DiscordMessages>
62+
</template>
63+
64+
<script setup>
65+
import {
66+
DiscordInteraction,
67+
DiscordMarkdown,
68+
DiscordMention,
69+
DiscordMessage,
70+
DiscordMessages,
71+
DiscordReaction,
72+
DiscordReactions,
73+
} from '@discord-message-components/vue'
74+
</script>
75+
```
76+
77+
### Usage inside Markdown files
78+
79+
If you're using a static site generator like [VuePress](https://vuepress.vuejs.org/) and want to use these components inside your Markdown files, you should use it as such:
80+
81+
```html
82+
<div is="discord-messages">
83+
<discord-message>
84+
...
85+
</discord-message>
86+
</div>
87+
```
88+
89+
This is the recommended approach due to how VuePress renders Markdown and HTML inside Markdown files. It doesn't recognize `<discord-messages>` as an HTML element, therefore rendering anything indented inside it as a regular codeblock.
90+
91+
### Upgrading from vue-discord-message
92+
93+
The components have been kept mostly the same, with many improvements and some breaking changes. `@discord-message-components/vue` doesn't support Vue 2 (yet), so be sure you're using Vue 3 with this package. [vue-discord-message](https://github.com/danktuary/vue-discord-message) supports Vue 2 but is outdated.
94+
95+
**New**:
96+
- Components: `DiscordButton(s)`, `DiscordInteraction`, `DiscordMarkdown`, and `DiscordReaction(s)`
97+
- Slots inside the `DiscordMessage` component: `actions` for buttons, `interactions` for replies and slash commands, `reactions` for reactions
98+
99+
**Breaking**:
100+
- Components are no longer globally registered. It's recommended to import them where necessary, or you may globally register them yourself
101+
- The `componentNames` and `disableFont` plugin options have been removed
102+
- The `EmbedField(s)` components have been renamed to `DiscordEmbedField(s)`
103+
- The `Mention` component has been renamed to `DiscordMention`
104+
- These component props have been renamed:
105+
- `DiscordEmbed#authorImage` -> `DiscordEmbed#authorIcon`
106+
- `DiscordEmbed#color` -> `DiscordEmbed#borderColor`
107+
- `DiscordEmbed#footerImage` -> `DiscordEmbed#footerIcon`
108+
- `DiscordEmbed#title` -> `DiscordEmbed#embedTitle`
109+
- `EmbedField#title` -> `DiscordEmbedField#fieldTitle`
110+
- `Mention#color` -> `DiscordMention#roleColor`
111+
112+
<details>
113+
<summary>These HTML elements/CSS selectors have been moved around:</summary>
114+
115+
- `.discord-author-info .discord-bot-tag` -> `.discord-author-info .discord-author-bot-tag`
116+
- `.discord-embed .discord-left-border` -> `.discord-embed .discord-embed-left-border`
117+
- `.discord-embed .discord-author-image` -> `.discord-embed .discord-embed-author-icon`
118+
- `.discord-embed-footer .discord-footer-image` -> `.discord-embed-footer .discord-embed-footer-icon`
119+
- `.discord-embed-footer .discord-footer-separator` -> `.discord-embed-footer .discord-embed-footer-separator`
120+
- `.discord-embed-footer .discord-footer-separator` -> `.discord-embed-footer .discord-embed-footer-separator`
121+
- `.discord-embed-field .discord-inline-field` -> `.discord-embed-field .discord-embed-field-inline`
122+
- `.discord-embed-field .discord-field-title` -> `.discord-embed-field .discord-embed-field-title`
123+
- `.discord-message > .discord-author-image` -> `.discord-message > .discord-message-content .discord-author-avatar`
124+
- `.discord-compact-mode .discord-message-content > .discord-message-timestamp` -> `.discord-compact-mode .discord-message-content .discord-message-body .discord-message-timestamp`
125+
- `.discord-message-content .discord-embed` -> `.discord-message-content .discord-message-body .discord-embed`
126+
127+
</details>

0 commit comments

Comments
 (0)