diff options
author | João Augusto Costa Branco Marado Torres <torres.dev@disroot.org> | 2025-06-24 16:13:59 -0300 |
---|---|---|
committer | João Augusto Costa Branco Marado Torres <torres.dev@disroot.org> | 2025-06-24 16:14:09 -0300 |
commit | a1eac976b20e39f86d5944fbec68e2a0f8ffb746 (patch) | |
tree | c06cdd2e974a97174e69988ae4a25e57f17bfc4e /src/components | |
parent | 6d7234a124972a86aba963ac4ebb30863c8de2ef (diff) |
feat: configurable header component
Signed-off-by: João Augusto Costa Branco Marado Torres <torres.dev@disroot.org>
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/Header.astro | 53 | ||||
-rw-r--r-- | src/components/Search.astro | 32 | ||||
-rw-r--r-- | src/components/signature/Commit.astro | 3 |
3 files changed, 52 insertions, 36 deletions
diff --git a/src/components/Header.astro b/src/components/Header.astro index 874a496..28ab542 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -1,41 +1,26 @@ --- import HeaderLink from "./HeaderLink.astro"; +import Search from "./Search.astro"; + +export interface Props { + showSearch?: boolean; + showNav?: boolean; +} + +const { showSearch, showNav } = Astro.props; --- <header> <h1><<a href="/">cravodeabril.pt</a>></h1> - <search> - <form - action="https://www.google.com/search" - target="_blank" - rel="external noreferrer search" - role="search" - autocomplete="on" - name="search" - > - <p> - <label>Barra de pesquisa: <input - name="q" - type="search" - placeholder={`site:${Astro.site} consulta de pesquisa`} - value={`site:${Astro.site} `} - required - title={`"site:${Astro.site} " é usado para que os resultados da pesquisa fiquem restritos a este website`} - pattern={`site:${Astro.site} .+`} - size={`site:${Astro.site} .+`.length} - /></label> - </p> - <p><button type="submit">Pesquisar</button></p> - <p> - <small>Esta pesquisa é efectuada pelo Google e utiliza software - proprietário.</small> - </p> - </form> - </search> - <nav> - <ul> - <li><HeaderLink href="/blog">Publicações</HeaderLink></li> - <li><HeaderLink href="/blog/keywords">Palavras-Chave</HeaderLink></li> - </ul> - </nav> + {showSearch && <Search />} + { + showNav && ( + <nav> + <ul> + <li><HeaderLink href="/blog">Publicações</HeaderLink></li> + <li><HeaderLink href="/blog/keywords">Palavras-Chave</HeaderLink></li> + </ul> + </nav> + ) + } </header> diff --git a/src/components/Search.astro b/src/components/Search.astro new file mode 100644 index 0000000..5ca4569 --- /dev/null +++ b/src/components/Search.astro @@ -0,0 +1,32 @@ +--- + +--- + +<search> + <form + action="https://www.google.com/search" + target="_blank" + rel="external noreferrer search" + role="search" + autocomplete="on" + name="search" + > + <p> + <label>Barra de pesquisa: <input + name="q" + type="search" + placeholder={`site:${Astro.site} consulta de pesquisa`} + value={`site:${Astro.site} `} + required + title={`"site:${Astro.site} " é usado para que os resultados da pesquisa fiquem restritos a este website`} + pattern={`site:${Astro.site} .+`} + size={`site:${Astro.site} .+`.length} + /></label> + </p> + <p><button type="submit">Pesquisar</button></p> + <p> + <small>Esta pesquisa é efectuada pelo Google e utiliza software + proprietário.</small> + </p> + </form> +</search> diff --git a/src/components/signature/Commit.astro b/src/components/signature/Commit.astro index 9cc997a..a2138ab 100644 --- a/src/components/signature/Commit.astro +++ b/src/components/signature/Commit.astro @@ -6,8 +6,7 @@ import { toIso8601Full } from "@utils/datetime"; type Props = { commit: Commit; lang: string }; const dir = await gitDir(); -const { hash, files, author, committer, signature } = - Astro.props.commit; +const { hash, files, author, committer, signature } = Astro.props.commit; const formatter = new Intl.DateTimeFormat([Astro.props.lang], { dateStyle: "short", |