Fixed styles for tailwind 4

This commit is contained in:
Alexis
2025-12-29 15:41:00 +01:00
parent 8a629cbdf6
commit 508f4cbea5
17 changed files with 454 additions and 523 deletions

View File

@@ -22,19 +22,20 @@
}, },
"devDependencies": { "devDependencies": {
"@rushstack/eslint-patch": "^1.3.3", "@rushstack/eslint-patch": "^1.3.3",
"@tailwindcss/postcss": "^4.1.18",
"@tailwindcss/vite": "^4.1.18",
"@tsconfig/node20": "^20.1.2", "@tsconfig/node20": "^20.1.2",
"@types/node": "^20.12.11", "@types/node": "^20.12.11",
"@vitejs/plugin-vue": "^5.0.4", "@vitejs/plugin-vue": "^5.0.4",
"@vue/eslint-config-prettier": "^8.0.0", "@vue/eslint-config-prettier": "^8.0.0",
"@vue/eslint-config-typescript": "^12.0.0", "@vue/eslint-config-typescript": "^12.0.0",
"@vue/tsconfig": "^0.5.1", "@vue/tsconfig": "^0.5.1",
"autoprefixer": "^10.4.19",
"eslint": "^8.49.0", "eslint": "^8.49.0",
"eslint-plugin-vue": "^9.17.0", "eslint-plugin-vue": "^9.17.0",
"postcss": "^8.4.38", "postcss": "^8.4.38",
"prettier": "^3.2.5", "prettier": "^3.2.5",
"start-server-and-test": "^2.0.3", "start-server-and-test": "^2.0.3",
"tailwindcss": "^3.4.3", "tailwindcss": "^4.1.18",
"typescript": "^5.4.5", "typescript": "^5.4.5",
"vite": "^5.2.11", "vite": "^5.2.11",
"vue-tsc": "^2.0.16" "vue-tsc": "^2.0.16"

732
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,5 @@
export default { export default {
plugins: { plugins: {
tailwindcss: {}, '@tailwindcss/postcss': {},
autoprefixer: {}
} }
} }

View File

@@ -1,14 +0,0 @@
.fade {
&-enter-from,
&-leave-to {
opacity: 0;
}
&-enter-to,
&-leave-from {
opacity: 1;
}
&-enter-active,
&-leave-active {
transition: all 0.2s ease;
}
}

View File

@@ -1,8 +0,0 @@
body {
@apply relative min-h-screen min-w-full text-y-beige-700 bg-y-beige-400 tracking-[-0.03em];
word-spacing: 0.5em;
&::before {
@apply absolute content-[''] h-full w-full bg-[url('/backgrounds/tile-bg.svg')] bg-[length:4px_4px] z-50 opacity-5 pointer-events-none select-none
}
}

57
src/assets/main.css Normal file
View File

@@ -0,0 +1,57 @@
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@200;300;400;500;700&display=swap');
@import "tailwindcss";
@theme {
--color-y-beige: #B0AB97;
--color-y-beige-50: #FFFFFF;
--color-y-beige-100: #F6F6F4;
--color-y-beige-200: #E5E3DD;
--color-y-beige-300: #D8D2B8;
--color-y-beige-400: #cbc5af;
--color-y-beige-500: #b0ab97;
--color-y-beige-600: #767563;
--color-y-beige-700: #4c4940;
--color-y-beige-800: #3A382C;
--color-y-beige-900: #2d2c21;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
.fade-enter-to,
.fade-leave-from {
opacity: 1;
}
.fade-enter-active,
.fade-leave-active {
transition: all 0.2s ease;
}
.y-scrollbar::-webkit-scrollbar-button {
display: none;
}
body {
position: relative;
min-height: 100dvh;
min-width: 100dvw;
color: var(--color-y-beige-700);
background-color: var(--color-y-beige-400);
letter-spacing: -0.03em;
word-spacing: 0.5em;
}
body::before {
position: absolute;
content: '';
height: 100%;
width: 100%;
background-size: 4px 4px;
background-image: url('/backgrounds/tile-bg.svg');
z-index: 50;
opacity: 5%;
pointer-events: none;
user-select: none;
}

View File

@@ -1,18 +0,0 @@
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@200;300;400;500;700&display=swap');
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
@import 'base/body';
}
@layer utilities {
@import 'utilities/scrollbar';
}
/**
* ANIMATIONS FOR TRANSITIONS
*/
@import 'animations/fade'

View File

@@ -1,5 +0,0 @@
.y-scrollbar {
&::-webkit-scrollbar-button {
display: none;
}
}

View File

@@ -47,7 +47,7 @@ function handleInactiveState() {
<li <li
v-for="item in props.items" v-for="item in props.items"
:key="item.id" :key="item.id"
class="transition-all" class="transition-all *:not-first:mt-3"
:class="item.id === clickedKey ? 'w-full' : 'w-11/12'" :class="item.id === clickedKey ? 'w-full' : 'w-11/12'"
> >
<YrhButton <YrhButton
@@ -72,10 +72,6 @@ function handleInactiveState() {
menu { menu {
position: relative; position: relative;
li:not(:first-child) {
@apply mt-3;
}
&::before { &::before {
display: block; display: block;
position: absolute; position: absolute;

View File

@@ -18,7 +18,7 @@ const props = defineProps<{
</span> </span>
</header> </header>
<figure v-if="slots.image" class="mx-4"> <figure v-if="slots.image" class="mx-4 after:content-[''] after:block after:w-full after:h-[0.1rem] after:my-3 after:bg-y-beige-500">
<div class="h-full bg-y-beige-500 grid place-items-center"> <div class="h-full bg-y-beige-500 grid place-items-center">
<slot name="image" /> <slot name="image" />
</div> </div>
@@ -38,7 +38,6 @@ const props = defineProps<{
figure { figure {
&::after { &::after {
content: ''; content: '';
@apply block w-full h-[0.1rem] my-3 bg-y-beige-500;
} }
} }
</style> </style>

View File

@@ -4,7 +4,7 @@ import YrhAudioSlider from './YrhAudioSlider.vue'
<template> <template>
<menu class="pl-11"> <menu class="pl-11">
<li> <li class="*:not-first:mt-3">
<YrhAudioSlider>Volume</YrhAudioSlider> <YrhAudioSlider>Volume</YrhAudioSlider>
</li> </li>
</menu> </menu>
@@ -14,10 +14,6 @@ import YrhAudioSlider from './YrhAudioSlider.vue'
menu { menu {
position: relative; position: relative;
li:not(:first-child) {
@apply mt-3;
}
&::before { &::before {
display: block; display: block;
position: absolute; position: absolute;

View File

@@ -19,7 +19,7 @@ function handleSelectedItem(item: GameItem) {
<template> <template>
<div class="h-full relative pl-11"> <div class="h-full relative pl-11">
<menu <menu
class="h-[calc(100%-16px)] overflow-auto py-2 bg-y-beige-300 max-h-full shadow-sharpest y-scrollbar" class="h-[calc(100%-16px)] overflow-auto py-2 bg-y-beige-300 max-h-full shadow-sharpest y-scrollbar after:-top-2 after:-bottom-2 after:w-4"
> >
<li v-for="item in props.items" :key="item.name" class="mb-2 last:mb-0"> <li v-for="item in props.items" :key="item.name" class="mb-2 last:mb-0">
<YrhButton <YrhButton
@@ -52,7 +52,9 @@ function handleSelectedItem(item: GameItem) {
<style lang="scss" scoped> <style lang="scss" scoped>
menu { menu {
&::before { &::before {
@apply block absolute -top-2 -bottom-2 left-0 w-4; display: block;
position: absolute;
left: 0;
content: ''; content: '';
border-left-width: 8px; border-left-width: 8px;
border-right-width: 2px; border-right-width: 2px;

View File

@@ -1,4 +1,4 @@
import './assets/main.scss' import './assets/main.css'
import { createApp } from 'vue' import { createApp } from 'vue'
import { createPinia } from 'pinia' import { createPinia } from 'pinia'
import App from './App.vue' import App from './App.vue'

View File

@@ -36,7 +36,7 @@ onMounted(() => {
</YrhHeading> </YrhHeading>
<section class="grid grid-cols-3 gap-x-10 my-14 overflow-auto"> <section class="grid grid-cols-3 gap-x-10 my-14 overflow-auto">
<div class="items-container max-h-full overflow-hidden"> <div class="items-container max-h-full overflow-hidden after:ml-11 before:ml-11 after:h-2 before:h-2 after:left-14 before:left-14 after:-right-14 before:-right-14 after:bg-y-beige-300 before:bg-y-beige-300 before:border-b-2 after:border-t-2">
<ItemSelection :items="availableItems" /> <ItemSelection :items="availableItems" />
</div> </div>
@@ -67,21 +67,25 @@ onMounted(() => {
<style lang="scss" scoped> <style lang="scss" scoped>
.items-container { .items-container {
@apply relative overflow-x-hidden; position: relative;
overflow-x: hidden;
&::before, &::before,
&::after { &::after {
display: block;
position: sticky;
width: 100%;
content: ''; content: '';
height: 0.1rem; height: 0.1rem;
@apply block sticky ml-11 w-full h-2 left-14 -right-14 z-10 bg-y-beige-300;
border-color: rgba(45, 44, 33, 0.33); border-color: rgba(45, 44, 33, 0.33);
z-index: 10;
} }
&::before { &::before {
@apply top-0 border-b-2; top: 0;
} }
&::after { &::after {
@apply bottom-0 border-t-2; bottom: 0;
} }
} }
</style> </style>

View File

@@ -1,57 +1,42 @@
/** @type {import('tailwindcss').Config} */ /** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'], content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
theme: { theme: {
container: { container: {
padding: '2rem', padding: '2rem',
center: true center: true
}, },
fontFamily: { fontFamily: {
sans: ['Noto Sans', 'ui-sans-serif', 'system-ui'], sans: ['Noto Sans', 'ui-sans-serif', 'system-ui'],
serif: ['ui-serif', 'Georgia'], serif: ['ui-serif', 'Georgia'],
mono: ['ui-monospace', 'SFMono-Regular'], mono: ['ui-monospace', 'SFMono-Regular'],
display: ['Oswald'], display: ['Oswald'],
body: ['Noto Sans'] body: ['Noto Sans']
}, },
extend: { extend: {
colors: { boxShadow: {
'y-beige': { sharpest: '2px 2px #2d2c2150'
DEFAULT: '#B0AB97', }
50: '#FFFFFF',
100: '#F6F6F4',
200: '#E5E3DD',
300: '#D8D2B8',
400: '#cbc5af',
500: '#b0ab97',
600: '#767563',
700: '#4c4940',
800: '#3A382C',
900: '#2d2c21'
} }
}, },
boxShadow: { plugins: [
sharpest: '2px 2px #2d2c2150' function ({ addBase, theme }) {
} function extractColorVars(colorObj, colorGroup = '') {
} return Object.keys(colorObj).reduce((vars, colorKey) => {
}, const value = colorObj[colorKey]
plugins: [
function ({ addBase, theme }) { const newVars =
function extractColorVars(colorObj, colorGroup = '') { typeof value === 'string'
return Object.keys(colorObj).reduce((vars, colorKey) => { ? { [`--color${colorGroup}-${colorKey}`]: value }
const value = colorObj[colorKey] : extractColorVars(value, `-${colorKey}`)
const newVars = return { ...vars, ...newVars }
typeof value === 'string' }, {})
? { [`--color${colorGroup}-${colorKey}`]: value } }
: extractColorVars(value, `-${colorKey}`)
addBase({
return { ...vars, ...newVars } ':root': extractColorVars(theme('colors'))
}, {}) })
} }
]
addBase({
':root': extractColorVars(theme('colors'))
})
}
]
} }

View File

@@ -3,7 +3,6 @@
"include": ["vite.config.*"], "include": ["vite.config.*"],
"compilerOptions": { "compilerOptions": {
"composite": true, "composite": true,
"module": "ESNext",
"types": ["node"] "types": ["node"]
} }
} }

View File

@@ -2,12 +2,14 @@ import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import tailwindcss from "@tailwindcss/vite";
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [vue()], plugins: [vue(), tailwindcss()],
resolve: { resolve: {
alias: { alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)) '@': fileURLToPath(new URL('./src', import.meta.url))
} }
} },
}) })