Skip to content

Commit b1f6c51

Browse files
committed
Upgrade app to Tailwind CSS v4 and daisyUI v5
1 parent 760ad1b commit b1f6c51

File tree

10 files changed

+125
-312
lines changed

10 files changed

+125
-312
lines changed

assets/css/app.css

+41-24
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,42 @@
1-
@import "tailwindcss/base";
2-
@import "tailwindcss/components";
3-
@import "tailwindcss/utilities";
4-
5-
@layer base {
6-
7-
html,
8-
body,
9-
[data-phx-main] {
10-
padding: 0;
11-
margin: 0;
12-
width: 100vw;
13-
height: 100vh;
14-
height: var(--app-height);
15-
}
16-
17-
body>[data-phx-main]>footer {
18-
position: sticky;
19-
top: 100dvh;
20-
}
21-
22-
:root {
23-
--app-height: 100%;
24-
}
1+
@import "tailwindcss";
2+
3+
@plugin "daisyui" {
4+
themes: light, dark --default --prefersdark;
5+
}
6+
7+
@plugin "daisyui/theme" {
8+
name: "light";
9+
--color-secondary: oklch(68.011% 0.158 276.934);
10+
--color-primary: oklch(0.488 0.243 264.376);
11+
}
12+
13+
@plugin "daisyui/theme" {
14+
name: "dark";
15+
--color-primary: oklch(68.5% 0.169 237.323);
16+
--color-secondary: oklch(68.011% 0.158 276.934);
17+
}
18+
19+
@plugin "../js/tailwind_heroicons.js";
20+
21+
@variant phx-click-loading ([".phx-click-loading&", ".phx-click-loading &"]);
22+
@variant phx-submit-loading ([".phx-submit-loading&", ".phx-submit-loading &"]);
23+
@variant phx-change-loading ([".phx-change-loading&", ".phx-change-loading &"]);
24+
25+
html,
26+
body,
27+
[data-phx-main] {
28+
padding: 0;
29+
margin: 0;
30+
width: 100vw;
31+
height: 100vh;
32+
height: var(--app-height);
33+
}
34+
35+
body>[data-phx-main]>footer {
36+
position: sticky;
37+
top: 100dvh;
38+
}
39+
40+
:root {
41+
--app-height: 100%;
2542
}

assets/js/tailwind_heroicons.js

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const plugin = require('tailwindcss/plugin')
2+
const fs = require('fs')
3+
const path = require('path')
4+
5+
module.exports = plugin(function ({ matchComponents, theme }) {
6+
const iconsDir = path.join(__dirname, '../../deps/heroicons/optimized')
7+
const values = {}
8+
const icons = [
9+
['', '/24/outline'],
10+
['-solid', '/24/solid'],
11+
['-mini', '/20/solid'],
12+
['-micro', '/16/solid']
13+
]
14+
icons.forEach(([suffix, dir]) => {
15+
fs.readdirSync(path.join(iconsDir, dir)).forEach(file => {
16+
const name = path.basename(file, '.svg') + suffix
17+
values[name] = { name, fullPath: path.join(iconsDir, dir, file) }
18+
})
19+
})
20+
matchComponents({
21+
hero: ({ name, fullPath }) => {
22+
let content = fs.readFileSync(fullPath).toString().replace(/\r?\n|\r/g, '')
23+
content = encodeURIComponent(content)
24+
let size = theme('spacing.6')
25+
if (name.endsWith('-mini')) {
26+
size = theme('spacing.5')
27+
} else if (name.endsWith('-micro')) {
28+
size = theme('spacing.4')
29+
}
30+
return {
31+
[`--hero-${name}`]: `url('data:image/svg+xml;utf8,${content}')`,
32+
'-webkit-mask': `var(--hero-${name})`,
33+
mask: `var(--hero-${name})`,
34+
'mask-repeat': 'no-repeat',
35+
'background-color': 'currentColor',
36+
'vertical-align': 'middle',
37+
display: 'inline-block',
38+
width: size,
39+
height: size
40+
}
41+
}
42+
}, { values })
43+
})

assets/package-lock.json

+5-147
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"topbar": "^3.0.0"
1010
},
1111
"devDependencies": {
12-
"daisyui": "4.12.24",
12+
"daisyui": "^5.0.0",
1313
"standard": "^17.1.2"
1414
}
1515
}

0 commit comments

Comments
 (0)