From 6f00481c25844bd01b0b2a4af91229e14e88c29c Mon Sep 17 00:00:00 2001 From: Jorge Vargas Date: Tue, 3 Sep 2024 17:47:49 -0600 Subject: [PATCH] Implement header banner --- astro.config.mjs | 5 +++-- package.json | 3 ++- src/components/Header.astro | 27 ++++++++++++++++++++------- src/graphql/typeDefs/site.graphql | 19 ++++++++----------- src/sequelize/models/config.ts | 3 ++- 5 files changed, 35 insertions(+), 22 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index 3ef4de6..cc97bf4 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -4,7 +4,7 @@ import node from '@astrojs/node' import paraglide from '@inlang/paraglide-astro' import auth from 'auth-astro' import { languageTags } from './project.inlang/settings.json' - +import { astroImageTools } from 'astro-imagetools' import icon from 'astro-icon' // https://astro.build/config @@ -26,7 +26,8 @@ export default defineConfig({ project: './project.inlang', outdir: './src/paraglide' //where your files should be }), - icon({ iconDir: 'src/img/icons' }) + icon({ iconDir: 'src/img/icons' }), + astroImageTools ], output: 'server', adapter: node({ diff --git a/package.json b/package.json index 331e3cc..9ed1b46 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "@sequelize/mysql": "^7.0.0-alpha.41", "astro": "^4.13.1", "astro-icon": "^1.1.1", + "astro-imagetools": "^0.9.0", "auth-astro": "^4.1.2", "bcrypt": "^5.1.1", "graphql-scalars": "^1.23.0", @@ -54,4 +55,4 @@ "optionalDependencies": { "@rollup/rollup-linux-x64-gnu": "4.9.5" } -} \ No newline at end of file +} diff --git a/src/components/Header.astro b/src/components/Header.astro index ef6789c..909028a 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -2,6 +2,8 @@ import { gql } from '@/graphql/__generated__/client' import { getApolloClient } from '@/graphql/apolloClient.mjs' import { Image } from 'astro:assets' +// @ts-ignore +import { Picture } from 'astro-imagetools/components' import { getSession } from 'auth-astro/server' import * as m from '../paraglide/messages.js' @@ -16,7 +18,10 @@ import NavButton from './header/NavButton.astro' const headerQuery = gql(` query HeaderInfo { - config(name: "banner") { + banner: config(name: "banner") { + value + } + bannerPosition: config(name: "banner-position") { value } } @@ -24,17 +29,25 @@ const headerQuery = gql(` const client = await getApolloClient() const { data: headerInfo } = await client.query({ query: headerQuery }) +const { banner, bannerPosition } = headerInfo const session = await getSession(Astro.request) ---
-