fix: style

This commit is contained in:
2026-04-02 14:24:00 +02:00
parent 1494af985a
commit 7c69d56a48
3 changed files with 54 additions and 28 deletions

View File

@@ -8,9 +8,9 @@ export const uiOptions: NuxtUIOptions = {
}
},
button: {
// slots: {
// base: 'border! border-(--border-light)! dark:border-(--border-dark)! outline-0! ring-0!',
// },
slots: {
base: 'px-10!',
},
},
input: {
slots: {

View File

@@ -29,6 +29,8 @@ body {
--border-dark: #3F3E3D;
/* text */
--accent-green-dark: #22c55e;
--accent-green-light: #16A34A;
--accent-blue-dark: #3B82F6;
--accent-blue-light: #2563EB;
--text-dark: #FFFEFB;

View File

@@ -9,44 +9,55 @@
<div
class=" gap-4 mb-6 bg-(--second-light) dark:bg-(--main-dark) border border-(--border-light) dark:border-(--border-dark) p-4 rounded-md">
<div v-if="!isShowProductView" class="flex items-center justify-between">
<div class="flex items-center gap-3" v-if="!isTranslations">
<p class="text-red-500 text-md whitespace-nowrap">Translate from Polish to</p>
<USelect v-model="toLangId" :items="availableLangs" value-key="id" label-key="name"
placeholder="Select language" class="w-48">
<template #selected="{ modelValue }">
{{ modelValue }}
</template>
<template #item-label="{ item }">
<div class="flex flex-col items-center gap-3" v-if="!isTranslations">
<p class="light:text-(--accent-green-light) dark:text-(--accent-green-dark) text-md whitespace-nowrap">
Translate from Polish to :</p>
<USelectMenu v-model="toLangId" :items="availableLangs" value-key="id" label-key="name"
class="w-48 bg-(--main-light) dark:bg-(--black) rounded-md shadow-sm" :searchInput="false">
<template #default>
<div class="flex items-center gap-2">
<span>{{ item.flag }}</span>
<span>{{ item.name }}</span>
<div class="flex flex-col leading-tight items-start">
<span class="text-xs text-gray-400">
Select language
</span>
<span class="font-medium dark:text-white text-black">
{{availableLangs.find(l => l.id === toLangId)?.name || 'Select language'}}
</span>
</div>
</div>
</template>
</USelect>
<template #item-leading="{ item }">
<div class="flex items-center gap-2">
<span>{{ item.flag }}</span>
<span class="font-medium dark:text-white text-black">{{ item.name }}</span>
</div>
</template>
</USelectMenu>
</div>
<div class="flex gap-3">
<div class="flex gap-7">
<UButton @click="() => {
fetchForLanguage(toLangId)
isShowProductView = true
}" color="primary" v-if="isTranslations === false"
class="text-white bg-(--accent-blue-light) dark:bg-(--accent-blue-dark) px-12!">
Show product
}" v-if="isTranslations === false" class="text-(--accent-blue-light) dark:text-(--accent-blue-dark)"
color="neutral" variant="outline">
<p class="dark:text-white"> Show product</p>
</UButton>
<UButton @click="translateToSelectedLanguage" color="primary" :loading="translating"
v-if="isTranslations === false"
class="text-white bg-(--accent-blue-light) dark:bg-(--accent-blue-dark) px-12!">
class="text-white bg-(--accent-blue-light) dark:bg-(--accent-blue-dark) flex items-center! justify-center! px-12">
Translate
</UButton>
<div v-else class="flex gap-3">
<UButton @click="() => {
toLangId = settingStore.shopDefaultLanguage
isTranslations = false
}" color="primary" class="text-white bg-(--accent-blue-light) dark:bg-(--accent-blue-dark) px-12!">
}" color="primary" class="text-white bg-(--accent-blue-light) dark:bg-(--accent-blue-dark)">
Cancel
</UButton>
<UButton color="primary" @click="productStore.saveProductDescription(productID, toLangId)"
class="text-white bg-(--accent-blue-light) dark:bg-(--accent-blue-dark) px-12!">
class="text-white bg-(--accent-blue-light) dark:bg-(--accent-blue-dark)">
Save
</UButton>
</div>
@@ -84,15 +95,18 @@
{{ productStore.productDescription.name || 'Product Name' }}
</p>
<p v-html="productStore.productDescription.description_short" class="text-black dark:text-white"></p>
<div class="space-y-[10px]">
<div class="flex items-center gap-1">
<UIcon name="lets-icons:done-ring-round-fill" class="text-[20px] text-green-600" />
<UIcon name="lets-icons:done-ring-round-fill"
class="text-[20px] light:text-(--accent-green-light) dark:text-(--accent-green-dark)" />
<p class="text-[16px] font-bold text-(--accent-blue-light) dark:text-(--accent-blue-dark)">
{{ productStore.productDescription.available_now }}
</p>
</div>
<div class="flex items-center gap-1">
<UIcon name="marketeq:car-shipping" class="text-[25px] text-green-600" />
<UIcon name="marketeq:car-shipping"
class="text-[25px] light:text-(--accent-green-light) dark:text-(--accent-green-dark)" />
<p class="text-[18px] font-bold text-black dark:text-white">
{{ productStore.productDescription.delivery_in_stock || 'Delivery information' }}
</p>
@@ -197,8 +211,6 @@ const productStore = useProductStore()
const isTranslations = ref(false)
const toLangId = ref(null)
const availableLangs = computed(() => langs.filter(item => item.id !== settingStore.shopDefaultLanguage))
const productID = ref<number>(0)
const translating = ref(false)
@@ -213,6 +225,8 @@ const originalDescription = ref('')
const isShowProductView = ref(false)
const availableLangs = computed(() => langs.filter(item => item.id !== settingStore.shopDefaultLanguage))
const translateToSelectedLanguage = async () => {
if (toLangId.value && productID.value) {
translating.value = true
@@ -231,7 +245,6 @@ const fetchForLanguage = async (langId: number | null) => {
if (productID.value) {
await productStore.getProductDescription(langId, productID.value)
removeInlineStylesFromAll(productStore.productDescription)
removePStyles(productStore.productDescription)
}
}
@@ -321,14 +334,25 @@ function removeInlineStylesFromAll(product) {
})
div.querySelectorAll('table').forEach(table => {
table.querySelectorAll('tbody').forEach(tbody => {
tbody.style.setProperty('background-color', 'white', 'important')
tbody.style.setProperty('background-color', '#F5F6FA', 'important')
tbody.querySelectorAll('tr').forEach(tr => {
tr.querySelectorAll('td').forEach(td => {
td.style.setProperty('padding', '10px', 'important')
td.style.setProperty('border-top', '1pt solid black', 'important')
td.style.setProperty('border-left', '1pt solid black', 'important')
td.style.setProperty('border-bottom', '1pt solid black', 'important')
td.style.setProperty('border-right', '1pt solid black', 'important')
td.querySelectorAll('p').forEach(p => {
p.style.setProperty('display', 'flex', 'important')
p.style.setProperty('padding', '0px', 'important')
p.style.setProperty('align-items', 'start', 'important')
p.style.setProperty('color', 'black', 'important')
p.style.setProperty('font-size', '14px', 'important')
p.querySelectorAll('span').forEach(span => {
span.style.setProperty('color', 'black', 'important')
span.style.setProperty('font-size', '14px', 'important')
})
})
})
})
@@ -341,4 +365,4 @@ function removeInlineStylesFromAll(product) {
product.usage = removeStyles(product.usage)
}
</script>
</script>