diff --git a/components/Header.css b/components/Header.css index cc73ead..e6ec2b8 100644 --- a/components/Header.css +++ b/components/Header.css @@ -151,29 +151,6 @@ header details { } } -.components__header__search { - padding: var(--_gap-half) var(--_gap); - align-self: center; - border: var(--_border-size) solid transparent; - background-color: var(--_translucent); - min-width: fit-content; - outline: none; - - &:focus-visible { - border: var(--_border-size) solid currentColor; - } - - @media (width < 800px) { - & { - background-color: transparent; - } - - & span { - display: none; - } - } -} - .components__header__nav_button { color: var(--_font-color); display: inline-block; diff --git a/components/Header.tsx b/components/Header.tsx index 738c0a5..9fc742a 100644 --- a/components/Header.tsx +++ b/components/Header.tsx @@ -1,4 +1,5 @@ import { asset } from '$fresh/runtime.ts' +import SearchBox from '../islands/SearchBox.tsx' import ThemePicker from '../islands/ThemePicker.tsx' export function Header() { @@ -61,10 +62,7 @@ export function Header() { - + diff --git a/islands/SearchBox.css b/islands/SearchBox.css new file mode 100644 index 0000000..7932d41 --- /dev/null +++ b/islands/SearchBox.css @@ -0,0 +1,64 @@ +.islands__search_box__button { + padding: var(--_gap-half) var(--_gap); + border: var(--_border-size) solid transparent; + background-color: var(--_translucent); + min-width: fit-content; + outline: none; + + &:focus-visible { + border: var(--_border-size) solid currentColor; + } + + @media (width < 800px) { + & { + background-color: transparent; + } + + & span { + display: none; + } + } +} + +.islands__search_box__dialog { + width: var(--_wide-screen); + height: 80%; + overflow-y: scroll; + border: var(--_border-size) solid currentColor; + background: var(--_background-image) repeat top left / 800px; + background-color: var(--_background-color); + padding: var(--_gap); + gap: var(--_gap); + grid-template-rows: auto 1fr; + + &[open] { + display: grid; + } + + &::backdrop { + backdrop-filter: blur(var(--_blur)); + } + + & input { + padding: var(--_gap-half) var(--_gap); + border: var(--_border-size) solid transparent; + background-color: var(--_translucent); + height: fit-content; + outline: none; + position: sticky; + top: 0; + + &:focus-visible { + border: var(--_border-size) solid currentColor; + } + } +} + +.islands__search_box__dialog__content { + padding: var(--_gap-half); + width: 100%; + height: 100%; + text-align: left; + text-wrap: balance; + display: grid; +} diff --git a/islands/SearchBox.tsx b/islands/SearchBox.tsx new file mode 100644 index 0000000..56324a9 --- /dev/null +++ b/islands/SearchBox.tsx @@ -0,0 +1,54 @@ +import { useEffect, useRef } from 'preact/hooks' + +export default function SearchBox() { + const dialog = useRef(null) + + useEffect(() => { + dialog.current?.addEventListener('click', (event) => { + if (event.target === dialog.current) { + dialog.current?.close() + } + }) + }, []) + + return ( + <> + + + +
+

Machines

+
    +
  • machine 1
  • +
  • machine 2
  • +
  • machine 3
  • +
+

Projets

+
    +
  • projet 1
  • +
  • projet 2
  • +
  • projet 3
  • +
+

Blog

+
    +
  • news 1
  • +
  • news 2
  • +
  • news 3
  • +
+

Usager

+
    +
  • Alice
  • +
  • Bob
  • +
  • ChloĆ©
  • +
+
+
+ + ) +} diff --git a/src/stylesheets/components.css b/src/stylesheets/components.css index 1e13bd6..8417a70 100644 --- a/src/stylesheets/components.css +++ b/src/stylesheets/components.css @@ -4,3 +4,4 @@ @import url('../../components/SponsorCards.css'); @import url('../../components/CohabitInfoTable.css'); @import url('../../islands/ThemePicker.css'); +@import url('../../islands/SearchBox.css');