mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-13 09:10:14 +00:00
Style changes
This commit is contained in:
parent
6b6cce486d
commit
ead1ae4e7c
5 changed files with 57 additions and 105 deletions
|
|
@ -1,7 +1,12 @@
|
|||
<template>
|
||||
<p class="command-example">
|
||||
<span class="example-comment" v-if="comment">// {{ comment }}</span>
|
||||
<span class="bot-prefix">pk;</span><slot></slot>
|
||||
<span class="bot-prefix">pk;</span><slot v-if="usage === undefined"/><span v-if="usage !== undefined">
|
||||
<span v-for="part in parse(usage)">
|
||||
<span v-if="part.type === 'str'">{{ part.str }}</span>
|
||||
<span v-else-if="part.type === 'arg'"><Arg>{{ part.arg }}</Arg></span>
|
||||
</span>
|
||||
</span>
|
||||
</p>
|
||||
</template>
|
||||
|
||||
|
|
@ -10,32 +15,58 @@
|
|||
font-size: $exampleFontSize;
|
||||
font-family: $exampleFontFamily;
|
||||
color: $exampleTextColor;
|
||||
|
||||
|
||||
background-color: $exampleBgColor;
|
||||
border-radius: 6px;
|
||||
|
||||
margin: 0.5rem 0;
|
||||
|
||||
/*margin: 1rem 0;*/
|
||||
padding: 0.75rem 1.25rem;
|
||||
|
||||
|
||||
clear: both;
|
||||
|
||||
margin-bottom: 10rem;
|
||||
}
|
||||
|
||||
|
||||
.custom-block.tip .command-example {
|
||||
background-color: $exampleBgColorInTip;
|
||||
}
|
||||
|
||||
|
||||
.bot-prefix {
|
||||
color: $examplePrefixColor;
|
||||
}
|
||||
|
||||
|
||||
.example-comment {
|
||||
color: $exampleCommentColor;
|
||||
float: right;
|
||||
//float: right;
|
||||
|
||||
//@media (max-width: $MQNarrow) {
|
||||
display: block;
|
||||
//float: none;
|
||||
margin-bottom: -0.15rem;
|
||||
//}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: ["comment"]
|
||||
props: ["usage", "comment"],
|
||||
methods: {
|
||||
parse(usage) {
|
||||
const parts = [];
|
||||
let lastMatch = 0;
|
||||
|
||||
for (const match of usage.matchAll(/`([^`]+)`/g)) {
|
||||
if (match.index > 0)
|
||||
parts.push({type: "str", str: usage.substring(lastMatch, match.index)});
|
||||
parts.push({type: "arg", arg: match[1]});
|
||||
lastMatch = match.index + match[0].length;
|
||||
}
|
||||
|
||||
if (lastMatch < usage.length)
|
||||
parts.push({type: "str", str: usage.substring(lastMatch)});
|
||||
|
||||
return parts;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue