menu switchin

This commit is contained in:
Marley 2023-12-10 14:51:44 -08:00
parent 1e01ec9e41
commit 6e42a3ff20
8 changed files with 115 additions and 53 deletions

View file

@ -1,50 +1,50 @@
const fs = require('fs') const fs = require("fs");
const postcss = require('postcss') const postcss = require("postcss");
const postcssImportExtGlob = require('postcss-import-ext-glob') const postcssImportExtGlob = require("postcss-import-ext-glob");
const postcssImport = require('postcss-import') const postcssImport = require("postcss-import");
const postcssPresetEnv = require('postcss-preset-env') const postcssPresetEnv = require("postcss-preset-env");
const cssnano = require('cssnano') const cssnano = require("cssnano");
// const esbuild = require('esbuild') const esbuild = require("esbuild");
const automaticNoopener = require('eleventy-plugin-automatic-noopener') const automaticNoopener = require("eleventy-plugin-automatic-noopener");
module.exports = function (eleventyConfig) { module.exports = function(eleventyConfig) {
eleventyConfig.on('eleventy.before', async () => { eleventyConfig.on("eleventy.before", async () => {
const cssSrc = './src/style/style.css' const cssSrc = "./src/style/style.css";
const cssDest = './dist/style.css' const cssDest = "./dist/style.css";
fs.readFile(cssSrc, (err, css) => { fs.readFile(cssSrc, (err, css) => {
// noinspection JSCheckFunctionSignatures // noinspection JSCheckFunctionSignatures
postcss([ postcss([
postcssImportExtGlob, postcssImportExtGlob,
postcssImport, postcssImport,
postcssPresetEnv, postcssPresetEnv,
cssnano cssnano
]) ])
.process(css, {from: cssSrc, to: cssDest}) .process(css, { from: cssSrc, to: cssDest })
.then(res => { .then(res => {
fs.writeFile(cssDest, res.css, () => true) fs.writeFile(cssDest, res.css, () => true);
}) });
}) });
// await esbuild.build({ await esbuild.build({
// entryPoints: ['src/js/main.js'], entryPoints: ["src/js/main.js"],
// bundle: true, bundle: true,
// minify: true, minify: true,
// target: 'es2020', target: "es2020",
// outfile: 'dist/main.js', outfile: "dist/main.js"
// })
// .then(() => console.log('🧳 esbuild done'))
// .catch(() => process.exit(1))
}) })
.then(() => console.log("🧳 esbuild done"))
.catch(() => process.exit(1));
});
eleventyConfig.addWatchTarget('./src/style/') eleventyConfig.addWatchTarget("./src/style/");
eleventyConfig.addWatchTarget('./src/js/') eleventyConfig.addWatchTarget("./src/js/");
eleventyConfig.addPlugin(automaticNoopener, { eleventyConfig.addPlugin(automaticNoopener, {
noreferrer: true, noreferrer: true
}) });
eleventyConfig.addPassthroughCopy('./src/img/') eleventyConfig.addPassthroughCopy("./src/img/");
return {dir: {input: 'src', output: 'dist'}} return { dir: { input: "src", output: "dist" } };
} };

21
node_modules/.package-lock.json generated vendored
View file

@ -1392,6 +1392,19 @@
"integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==",
"dev": true "dev": true
}, },
"node_modules/@vue/reactivity": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.1.5.tgz",
"integrity": "sha512-1tdfLmNjWG6t/CsPldh+foumYFo3cpyCHgBYQ34ylaMsJ+SNHQ1kApMIa8jN+i593zQuaw3AdWH0nJTARzCFhg==",
"dependencies": {
"@vue/shared": "3.1.5"
}
},
"node_modules/@vue/shared": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.1.5.tgz",
"integrity": "sha512-oJ4F3TnvpXaQwZJNF3ZK+kLPHKarDmJjJ6jyzVNDKH9md1dptjC7lWR//jrGuLdek/U6iltWxqAnYOu8gCiOvA=="
},
"node_modules/a-sync-waterfall": { "node_modules/a-sync-waterfall": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz",
@ -1426,6 +1439,14 @@
"url": "https://github.com/sponsors/epoberezkin" "url": "https://github.com/sponsors/epoberezkin"
} }
}, },
"node_modules/alpinejs": {
"version": "3.13.3",
"resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.13.3.tgz",
"integrity": "sha512-WZ6WQjkAOl+WdW/jukzNHq9zHFDNKmkk/x6WF7WdyNDD6woinrfXCVsZXm0galjbco+pEpYmJLtwlZwcOfIVdg==",
"dependencies": {
"@vue/reactivity": "~3.1.1"
}
},
"node_modules/ansi-regex": { "node_modules/ansi-regex": {
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",

24
package-lock.json generated
View file

@ -9,7 +9,8 @@
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@punkfairie/modern-css-reset": "^1.0.1" "@punkfairie/modern-css-reset": "^1.0.1",
"alpinejs": "^3.13.3"
}, },
"devDependencies": { "devDependencies": {
"@11ty/eleventy": "^2.0.1", "@11ty/eleventy": "^2.0.1",
@ -1749,6 +1750,19 @@
"integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==",
"dev": true "dev": true
}, },
"node_modules/@vue/reactivity": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.1.5.tgz",
"integrity": "sha512-1tdfLmNjWG6t/CsPldh+foumYFo3cpyCHgBYQ34ylaMsJ+SNHQ1kApMIa8jN+i593zQuaw3AdWH0nJTARzCFhg==",
"dependencies": {
"@vue/shared": "3.1.5"
}
},
"node_modules/@vue/shared": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.1.5.tgz",
"integrity": "sha512-oJ4F3TnvpXaQwZJNF3ZK+kLPHKarDmJjJ6jyzVNDKH9md1dptjC7lWR//jrGuLdek/U6iltWxqAnYOu8gCiOvA=="
},
"node_modules/a-sync-waterfall": { "node_modules/a-sync-waterfall": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz",
@ -1783,6 +1797,14 @@
"url": "https://github.com/sponsors/epoberezkin" "url": "https://github.com/sponsors/epoberezkin"
} }
}, },
"node_modules/alpinejs": {
"version": "3.13.3",
"resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.13.3.tgz",
"integrity": "sha512-WZ6WQjkAOl+WdW/jukzNHq9zHFDNKmkk/x6WF7WdyNDD6woinrfXCVsZXm0galjbco+pEpYmJLtwlZwcOfIVdg==",
"dependencies": {
"@vue/reactivity": "~3.1.1"
}
},
"node_modules/ansi-regex": { "node_modules/ansi-regex": {
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",

View file

@ -24,6 +24,7 @@
"stylelint": "^15.11.0" "stylelint": "^15.11.0"
}, },
"dependencies": { "dependencies": {
"@punkfairie/modern-css-reset": "^1.0.1" "@punkfairie/modern-css-reset": "^1.0.1",
"alpinejs": "^3.13.3"
} }
} }

View file

@ -8,16 +8,18 @@
<title>... Epiphany ... baby, it's cold outsite ...</title> <title>... Epiphany ... baby, it's cold outsite ...</title>
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<link rel="stylesheet" href="/style.css"> <link rel="stylesheet" href="/style.css">
<!--suppress HtmlUnknownTarget -->
<script src="/main.js" type="module"></script>
</head> </head>
<body> <body>
<div class="site"> <div class="site" x-data="{menu: 'index'}">
<header> <header>
<h1>Epiphany</h1> <h1>Epiphany</h1>
<nav class="main-nav"> <nav class="main-nav">
<a href="/">index</a> <a href="/">index</a>
<a href="#">adoptions</a> <a href="#" x-on:click="menu = 'adoptions'">adoptions</a>
<a href="#">about</a> <a href="#" x-on:click="menu = 'about'">about</a>
</nav> </nav>
</header> </header>
@ -25,7 +27,17 @@
{{ content }} {{ content }}
</main> </main>
<nav class="secondary-nav"></nav> <nav class="secondary-nav" id="index" x-show="menu === 'index'">
<img src="/img/petz/siren-2.png" alt="Siren">
</nav>
<nav class="secondary-nav" id="adoptions" x-show="menu === 'adoptions'">
adoptions menu
</nav>
<nav class="secondary-nav" id="about" x-show="menu === 'about'">
about menu
</nav>
</div> </div>
</body> </body>
</html> </html>

BIN
src/img/petz/siren-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

5
src/js/main.js Normal file
View file

@ -0,0 +1,5 @@
import Alpine from "alpinejs";
window.Alpine = Alpine;
Alpine.start();

View file

@ -11,6 +11,8 @@
'. .' 1.5fr '. .' 1.5fr
'header header' 0.5fr 'header header' 0.5fr
's-nav main' 2.5fr / 1fr 5fr; 's-nav main' 2.5fr / 1fr 5fr;
grid-column-gap: var(--space-s);
width: 1024px; width: 1024px;
height: 768px; height: 768px;
padding: var(--space-xs); padding: var(--space-xs);
@ -31,15 +33,15 @@
column-gap: var(--space-m); column-gap: var(--space-m);
} }
h1 {
}
.main-nav { .main-nav {
display: flex; display: flex;
column-gap: var(--space-xs); column-gap: var(--space-xs);
} }
main, .secondary-nav {
background-color: rgba(255, 255, 255, 0.49);
}
main { main {
--flow-space: var(--space-xs); --flow-space: var(--space-xs);
@ -47,7 +49,6 @@
padding: var(--space-s); padding: var(--space-s);
overflow: auto; overflow: auto;
text-align: center; text-align: center;
background-color: rgba(255, 255, 255, 0.49);
} }
.secondary-nav { .secondary-nav {