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: { button: {
// slots: { slots: {
// base: 'border! border-(--border-light)! dark:border-(--border-dark)! outline-0! ring-0!', base: 'px-10!',
// }, },
}, },
input: { input: {
slots: { slots: {

View File

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

View File

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