Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"dependencies": {
"@codemirror/lang-css": "^6.0.0",
"@codemirror/theme-one-dark": "^6.0.0",
"@headlessui/vue": "1.7.23",
"axios": "^0.28.0",
"codemirror": "^6.0.0",
"vue": "^3.2.25"
Expand Down
29 changes: 29 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

101 changes: 82 additions & 19 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { utoa, atou, LESS_DATA } from './utils'
import Header from '@components/Header.vue'
import Editor from '@components/Editor.vue'
import Layout from '@components/Layout.vue'
import Select from '@components/Select.vue'
import { Switch } from '@headlessui/vue'

const mathOptions = ['always', 'parens-division', 'parens'].map(value => ({ value }))

let input = $ref(LESS_DATA)
let output = $ref<string | undefined>('')
Expand Down Expand Up @@ -76,20 +80,18 @@ onMounted(() => {
</template>
<template #options>
<h3>Options</h3>
<div>
<label>Math mode</label>
<select v-model="store.math">
<option>always</option>
<option>parens-division</option>
<option>parens</option>
</select>
<div class="option">
<span>Math mode</span>
<Select v-model="store.math" :options="mathOptions" />
</div>

<label>
<input type="checkbox" v-model="store.strictUnits" />
<Switch
v-model="store.strictUnits"
class="option switch"
:class="{ on: store.strictUnits }"
>
<span>Strict units</span>
</label>

<span class="switch-track" aria-hidden="true"><span class="switch-thumb"></span></span>
</Switch>
</template>
<template #preview>
<editor v-model:value="output" readOnly />
Expand All @@ -102,16 +104,17 @@ onMounted(() => {
</Layout>
</template>
<style lang="less">
@import './theme.less';

html,
body {
margin: 0;
font-family: system-ui, sans-serif;
}

@base: #35495e;

body {
background: @base;
color: @text;
}

*,
Expand All @@ -130,13 +133,73 @@ body {
}
}

.options {
h3 {
font-family: @font;
font-weight: 300;
letter-spacing: 1px;
color: white;
}
.option {
display: flex;
flex-direction: column;
gap: 6px;
font-size: 14px;
color: @muted;
}
.switch {
flex-direction: row;
align-items: center;
justify-content: space-between;
background: none;
border: none;
padding: 0;
font: inherit;
color: @muted;
cursor: pointer;
&:focus-visible .switch-track {
outline: 2px solid @accent;
outline-offset: 1px;
}
}
.switch-track {
position: relative;
width: 36px;
height: 20px;
border-radius: 10px;
background: darken(@base, 10%);
border: 1px solid lighten(@base, 12%);
transition: background 0.15s;
}
.switch-thumb {
position: absolute;
top: 2px;
left: 2px;
width: 14px;
height: 14px;
border-radius: 50%;
background: @muted;
transition: transform 0.15s, background 0.15s;
}
.switch.on {
.switch-track {
background: @accent;
border-color: @accent;
}
.switch-thumb {
background: white;
transform: translateX(16px);
}
}
}

.error {
color: hsl(10, 89%, 78%);
background: hsl(10, 89%, 26%);
height: 28px;
padding: 2px 8px;
position: relative;
top: -6px;
animation: opac 1s;
border-top: 1px solid @border;
padding: 6px 12px;
font-size: 14px;
font-family: @font;
animation: opac 0.3s;
}
</style>
Loading
Loading