diff --git a/docs-app/package.json b/docs-app/package.json index 6ed0fa70..fb616a1a 100644 --- a/docs-app/package.json +++ b/docs-app/package.json @@ -60,7 +60,7 @@ "ember-eslint": "^0.7.0", "ember-modifier": "^4.3.0", "ember-page-title": "^9.0.3", - "ember-primitives": "^0.61.1", + "ember-primitives": "^0.62.0", "ember-qunit": "^9.1.0", "ember-resolver": "^13.2.0", "ember-resources": "^7.1.0", diff --git a/docs-app/src/styles/app.css b/docs-app/src/styles/app.css index ca9bb07b..eeaa1fe2 100644 --- a/docs-app/src/styles/app.css +++ b/docs-app/src/styles/app.css @@ -32,6 +32,60 @@ a[data-search-result]:is(:hover, :focus, :active) { text-decoration: none; } +/* + * in pico's colours. The component brings its own layout; these + * are the only values it asks for. + */ +:root { + --kolay-search-bg: var(--pico-background-color); + --kolay-search-fg: var(--pico-color); + --kolay-search-muted: var(--pico-muted-color); + --kolay-search-border: var(--pico-muted-border-color); + --kolay-search-accent: var(--pico-primary); + --kolay-search-active: color-mix(in oklab, var(--pico-primary), transparent 88%); +} + +/* the palette's results are anchors too, and pico reaches them the same way */ +a.kolay__search__result, +a.kolay__search__result:is(:hover, :focus, :active) { + --pico-color: inherit; + --pico-background-color: inherit; + color: inherit; + text-decoration: none; +} + +/* + * The palette's input. Pico reaches every text input through a selector that + * carries an attribute, which outranks the component's single class, and + * gives it a box and a bottom margin the palette does not want. + */ +input.kolay__search__input { + height: auto; + margin: 0; + padding: 0; + border: none; + background: none; + box-shadow: none; +} + +/* the header's middle column */ +header .kolay__search__trigger { + flex: 1; + max-width: 24rem; +} + +@media (width < 1000px) { + header .kolay__search__trigger { + max-width: 18rem; + } +} + +@media (width < 600px) { + header .kolay__search__trigger { + max-width: none; + } +} + /* * The shine's colours. Kept as their own names so the sweep can be retuned in * one place: the site's primary at the leading edge, running through violet diff --git a/docs-app/src/templates/application.gts b/docs-app/src/templates/application.gts index 45b8a298..113b0fb6 100644 --- a/docs-app/src/templates/application.gts +++ b/docs-app/src/templates/application.gts @@ -7,9 +7,8 @@ import { pascalCase, sentenceCase } from 'change-case'; // @ts-expect-error no types for the mobile-menu import MenuWrapper from 'ember-mobile-menu/components/mobile-menu-wrapper'; import { pageTitle } from 'ember-page-title'; -import { Form } from 'ember-primitives/components/form'; import Route from 'ember-route-template'; -import { GroupNav, PageNav } from 'kolay/components'; +import { GroupNav, PageNav, Search } from 'kolay/components'; import rememberDocumentScroll from 'memory-scroll/modifiers/remember-document-scroll'; import { ExternalLink } from 'nvp.ui'; @@ -73,83 +72,6 @@ const Menu: TOC<{ Element: SVGElement }> = ; -class HeaderSearch extends Component<{ Args: Record }> { - @service declare router: RouterService; - - get isSearchRoute() { - return this.router.currentRouteName === 'search'; - } - - submit = (data: { q?: string }) => { - const q = data.q ?? ''; - - this.router.transitionTo('search', { queryParams: { q } }); - }; - - -} - const SideNav: TOC<{ Element: HTMLElement }> =