refactor(ui): switched n-select to c-select

This commit is contained in:
Corentin Thomasset 2023-08-07 17:19:19 +02:00
parent 6b17025c6b
commit 36921d8c06
No known key found for this signature in database
GPG key ID: DBD997E935996158
5 changed files with 64 additions and 59 deletions

View file

@ -39,13 +39,15 @@ const endAt = computed(() =>
</n-form-item>
</div>
<n-form-item label="Amount of unit consumed by time span" :show-feedback="false">
<p>Amount of unit consumed by time span</p>
<div flex flex-col items-baseline gap-y-2 md:flex-row>
<n-input-number v-model:value="unitPerTimeSpan" :min="1" />
<span mx-3>in</span>
<n-input-group>
<n-input-number v-model:value="timeSpan" :min="1" />
<n-select
<div flex items-baseline gap-2>
<span ml-2>in</span>
<n-input-number v-model:value="timeSpan" min-w-130px :min="1" />
<c-select
v-model:value="timeSpanUnitMultiplier"
min-w-130px
:options="[
{ label: 'milliseconds', value: 1 },
{ label: 'seconds', value: 1000 },
@ -54,8 +56,8 @@ const endAt = computed(() =>
{ label: 'days', value: 1000 * 60 * 60 * 24 },
]"
/>
</n-input-group>
</n-form-item>
</div>
</div>
<n-divider />
<c-card mb-2>

View file

@ -53,12 +53,15 @@ const metaTags = computed(() => {
<template>
<div>
<div v-for="{ name, elements } of sections" :key="name" style="margin-bottom: 15px">
<n-form-item :label="name" :show-feedback="false" />
<div mb-5px>
{{ name }}
</div>
<n-input-group v-for="{ key, type, label, placeholder, ...element } of elements" :key="key">
<n-input-group-label style="flex: 0 0 110px">
{{ label }}
</n-input-group-label>
<c-input-text v-if="type === 'input'" v-model:value="metadata[key]" :placeholder="placeholder" clearable />
<n-dynamic-input
v-else-if="type === 'input-multiple'"
@ -69,9 +72,10 @@ const metaTags = computed(() => {
:show-sort-button="true"
/>
<n-select
<c-select
v-else-if="type === 'select'"
v-model:value="metadata[key]"
w-full
:placeholder="placeholder"
:options="(element as OGSchemaTypeElementSelect).options"
/>

View file

@ -85,9 +85,7 @@ const countriesOptions = getCountries().map(code => ({
<template>
<div>
<n-form-item label="Default country code:">
<n-select v-model:value="defaultCountryCode" :options="countriesOptions" filterable />
</n-form-item>
<c-select v-model:value="defaultCountryCode" label="Default country code:" :options="countriesOptions" searchable mb-5 />
<c-input-text
v-model:value="rawPhone"

View file

@ -35,6 +35,7 @@ const { download } = useDownloadFileFromBase64({ source: qrcode, filename: 'qr-c
label="Text:"
multiline
rows="1"
autosize
placeholder="Your link or text..."
mb-6
/>
@ -45,12 +46,14 @@ const { download } = useDownloadFileFromBase64({ source: qrcode, filename: 'qr-c
<n-form-item label="Background color:">
<n-color-picker v-model:value="background" :modes="['hex']" />
</n-form-item>
<n-form-item label="Error resistance:">
<n-select
v-model:value="errorCorrectionLevel"
:options="errorCorrectionLevels.map((value) => ({ label: value, value }))"
/>
</n-form-item>
<c-select
v-model:value="errorCorrectionLevel"
label="Error resistance:"
label-position="left"
label-width="130px"
label-align="right"
:options="errorCorrectionLevels.map((value) => ({ label: value, value }))"
/>
</n-form>
</n-gi>
<n-gi>

View file

@ -19,47 +19,45 @@ const prettySQL = computed(() => formatSQL(rawSQL.value, config));
<template>
<div style="flex: 0 0 100%">
<div mx-auto style="max-width: 600px" flex gap-2 :class="{ 'flex-col': styleStore.isSmallScreen }">
<n-form-item label="Dialect" label-width="500" flex-1>
<n-select
v-model:value="config.language"
:options="[
{ label: 'GCP BigQuery', value: 'bigquery' },
{ label: 'IBM DB2', value: 'db2' },
{ label: 'Apache Hive', value: 'hive' },
{ label: 'MariaDB', value: 'mariadb' },
{ label: 'MySQL', value: 'mysql' },
{ label: 'Couchbase N1QL', value: 'n1ql' },
{ label: 'Oracle PL/SQL', value: 'plsql' },
{ label: 'PostgreSQL', value: 'postgresql' },
{ label: 'Amazon Redshift', value: 'redshift' },
{ label: 'Spark', value: 'spark' },
{ label: 'Standard SQL', value: 'sql' },
{ label: 'sqlite', value: 'sqlite' },
{ label: 'SQL Server Transact-SQL', value: 'tsql' },
]"
/>
</n-form-item>
<n-form-item label="Keyword case" flex-1>
<n-select
v-model:value="config.keywordCase"
:options="[
{ label: 'UPPERCASE', value: 'upper' },
{ label: 'lowercase', value: 'lower' },
{ label: 'Preserve', value: 'preserve' },
]"
/>
</n-form-item>
<n-form-item label="Indent style" flex-1>
<n-select
v-model:value="config.indentStyle"
:options="[
{ label: 'Standard', value: 'standard' },
{ label: 'Tabular left', value: 'tabularLeft' },
{ label: 'Tabular right', value: 'tabularRight' },
]"
/>
</n-form-item>
<div style="max-width: 600px" :class="{ 'flex-col': styleStore.isSmallScreen }" mx-auto mb-5 flex gap-2>
<c-select
v-model:value="config.language"
flex-1
label="Dialect"
:options="[
{ label: 'GCP BigQuery', value: 'bigquery' },
{ label: 'IBM DB2', value: 'db2' },
{ label: 'Apache Hive', value: 'hive' },
{ label: 'MariaDB', value: 'mariadb' },
{ label: 'MySQL', value: 'mysql' },
{ label: 'Couchbase N1QL', value: 'n1ql' },
{ label: 'Oracle PL/SQL', value: 'plsql' },
{ label: 'PostgreSQL', value: 'postgresql' },
{ label: 'Amazon Redshift', value: 'redshift' },
{ label: 'Spark', value: 'spark' },
{ label: 'Standard SQL', value: 'sql' },
{ label: 'sqlite', value: 'sqlite' },
{ label: 'SQL Server Transact-SQL', value: 'tsql' },
]"
/>
<c-select
v-model:value="config.keywordCase" label="Keyword case"
flex-1
:options="[
{ label: 'UPPERCASE', value: 'upper' },
{ label: 'lowercase', value: 'lower' },
{ label: 'Preserve', value: 'preserve' },
]"
/>
<c-select
v-model:value="config.indentStyle" label="Indent style"
flex-1
:options="[
{ label: 'Standard', value: 'standard' },
{ label: 'Tabular left', value: 'tabularLeft' },
{ label: 'Tabular right', value: 'tabularRight' },
]"
/>
</div>
</div>