diff --git a/.prettierrc.mjs b/.prettierrc.mjs new file mode 100644 index 0000000..7e61930 --- /dev/null +++ b/.prettierrc.mjs @@ -0,0 +1,12 @@ +/** @type {import("prettier").Config} */ +export default { + plugins: ["prettier-plugin-astro"], + overrides: [ + { + files: "*.astro", + options: { + parser: "astro", + }, + }, + ], +}; diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a1f8488 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "prettier.documentSelectors": ["*.{astro, js, ts}"], + "css.customData": [".vscode/tailwind.json"] +} diff --git a/.vscode/tailwind.json b/.vscode/tailwind.json new file mode 100644 index 0000000..9ccc998 --- /dev/null +++ b/.vscode/tailwind.json @@ -0,0 +1,55 @@ +{ + "version": 1.1, + "atDirectives": [ + { + "name": "@tailwind", + "description": "Use the `@tailwind` directive to insert Tailwind's `base`, `components`, `utilities` and `screens` styles into your CSS.", + "references": [ + { + "name": "Tailwind Documentation", + "url": "https://tailwindcss.com/docs/functions-and-directives#tailwind" + } + ] + }, + { + "name": "@apply", + "description": "Use the `@apply` directive to inline any existing utility classes into your own custom CSS. This is useful when you find a common utility pattern in your HTML that you’d like to extract to a new component.", + "references": [ + { + "name": "Tailwind Documentation", + "url": "https://tailwindcss.com/docs/functions-and-directives#apply" + } + ] + }, + { + "name": "@responsive", + "description": "You can generate responsive variants of your own classes by wrapping their definitions in the `@responsive` directive:\n```css\n@responsive {\n .alert {\n background-color: #E53E3E;\n }\n}\n```\n", + "references": [ + { + "name": "Tailwind Documentation", + "url": "https://tailwindcss.com/docs/functions-and-directives#responsive" + } + ] + }, + { + "name": "@screen", + "description": "The `@screen` directive allows you to create media queries that reference your breakpoints by **name** instead of duplicating their values in your own CSS:\n```css\n@screen sm {\n /* ... */\n}\n```\n…gets transformed into this:\n```css\n@media (min-width: 640px) {\n /* ... */\n}\n```\n", + "references": [ + { + "name": "Tailwind Documentation", + "url": "https://tailwindcss.com/docs/functions-and-directives#screen" + } + ] + }, + { + "name": "@variants", + "description": "Generate `hover`, `focus`, `active` and other **variants** of your own utilities by wrapping their definitions in the `@variants` directive:\n```css\n@variants hover, focus {\n .btn-brand {\n background-color: #3182CE;\n }\n}\n```\n", + "references": [ + { + "name": "Tailwind Documentation", + "url": "https://tailwindcss.com/docs/functions-and-directives#variants" + } + ] + } + ] + } \ No newline at end of file diff --git a/astro.config.mjs b/astro.config.mjs index 6914036..d593821 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,14 +1,61 @@ import { defineConfig } from "astro/config"; +import sitemap from "@astrojs/sitemap"; import tailwind from "@astrojs/tailwind"; import solidJs from "@astrojs/solid-js"; +// import pagefind from "integrations/pagefind"; +import { loadEnv } from "vite"; import icon from "astro-icon"; -import sitemap from "@astrojs/sitemap"; +const { IS_PUBLIC, PRE_BUILD, CUSTOM_DOMAIN } = loadEnv( + process.env.NODE_ENV, + process.cwd(), + "", +); +const is_public = IS_PUBLIC === "true"; +const is_pre_build = PRE_BUILD === "true"; // https://astro.build/config export default defineConfig({ - output: "static", - integrations: [icon({iconDir: "src/assets/icons"}), solidJs(), tailwind({ - applyBaseStyles: false - }), sitemap()] -}); \ No newline at end of file + ...(is_public + ? { + output: "static", + integrations: [ + icon({ iconDir: "src/assets/icons" }), + solidJs(), + tailwind({ + applyBaseStyles: false, + }), + sitemap(), + // pagefind({ + // is_pre_build: is_pre_build, + // is_public: is_public, + // }), + ], + } + : {}), + site: `https://${CUSTOM_DOMAIN}`, + cacheDir: "./cache", + compressHTML: true, + image: { + remotePatterns: [ + { + protocol: "https", + }, + ], + // service: { + // entrypoint: "astro/assets/services/sharp", + // config: { + // limitInputPixels: false, + // }, + // }, + }, + // build: { + // rollupOptions: { + // external: ["/pagefind/pagefind.js"], + // }, + // redirects: true, + // }, + vite: { + optimizeDeps: { exclude: ["auth:config"] }, + }, +}); diff --git a/bin/install.mjs b/bin/install.mjs deleted file mode 100755 index c53b399..0000000 --- a/bin/install.mjs +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env node -import { promisify } from "util"; -import cp from "child_process"; -import path from "path"; -import fs, { existsSync, mkdirSync } from "fs"; -// cli spinners -import ora from "ora"; - -// convert libs to promises -const exec = promisify(cp.exec); -const rm = promisify(fs.rm); - -if (process.argv.length < 3) { - console.log("You have to provide a name to your app."); - console.log("For example :"); - console.log(" npx simple-ts-app my-app"); - process.exit(1); -} - -const projectName = process.argv[2]; -const currentPath = process.cwd(); -const projectPath = path.join(currentPath, projectName); -// TODO: change to your boilerplate repo -const git_repo = "https://github.com/Linaro/ecosystemlandscape-astro.git"; - -// create project directory -if (fs.existsSync(projectPath)) { - console.log( - `The file ${projectName} already exist in the current directory, please give it another name.` - ); - process.exit(1); -} else { - fs.mkdirSync(projectPath); -} - -try { - const gitSpinner = ora("Downloading files...").start(); - // clone the repo into the project folder -> creates the new boilerplate - await exec(`git clone --depth 1 ${git_repo} ${projectPath} --quiet`); - gitSpinner.succeed(); - - const cleanSpinner = ora("Removing useless files").start(); - // remove my git history - const rmGit = rm(path.join(projectPath, ".git"), { - recursive: true, - force: true, - }); - // remove the installation file - const rmBin = rm(path.join(projectPath, "bin"), { - recursive: true, - force: true, - }); - await Promise.all([rmGit, rmBin]); - - process.chdir(projectPath); - // remove the packages needed for cli - await exec("yarn remove ora"); - cleanSpinner.succeed(); - - const npmSpinner = ora("Installing dependencies...").start(); - await exec("yarn install"); - await exec("npx npm-check-updates -u"); - await exec("yarn install"); - npmSpinner.succeed(); - - console.log("The installation is done!"); - console.log("You can now run your app with:"); - console.log(` cd ${projectName}`); - console.log(` yarn dev`); -} catch (error) { - // clean up in case of error, so the user does not have to do it manually - fs.rmSync(projectPath, { recursive: true, force: true }); - console.log(error); -} diff --git a/integrations/pagefind.ts b/integrations/pagefind.ts new file mode 100644 index 0000000..ac35496 --- /dev/null +++ b/integrations/pagefind.ts @@ -0,0 +1,57 @@ +import type { AstroIntegration } from "astro"; +import { execSync } from "child_process"; +import sirv from "sirv"; + +export default function pagefind({ + is_pre_build, + is_public, +}: { + is_pre_build: boolean; + is_public: boolean; +}): AstroIntegration { + let outDir: string; + if (is_pre_build) return { name: "pagefind", hooks: {} }; + return { + name: "pagefind", + hooks: { + "astro:config:setup": ({ config, logger }) => { + outDir = is_public ? "./dist" : "./dist_prebuild/dist/client"; + }, + "astro:server:setup": ({ server, logger }) => { + if (!outDir) { + logger.warn( + "astro-pagefind couldn't reliably determine the output directory. Search assets will not be served.", + ); + return; + } + logger.warn(outDir); + const serve = sirv(outDir, { + dev: true, + etag: true, + }); + server.middlewares.use((req, res, next) => { + if (req.url?.startsWith("/pagefind/")) { + serve(req, res, next); + } else { + next(); + } + }); + }, + "astro:build:done": ({ logger }) => { + logger.warn(outDir); + + if (!outDir) { + logger.warn( + "astro-pagefind couldn't reliably determine the output directory. Search index will not be built.", + ); + return; + } + + const cmd = `npx pagefind --site "${outDir}"`; + execSync(cmd, { + stdio: [process.stdin, process.stdout, process.stderr], + }); + }, + }, + }; +} diff --git a/package.json b/package.json index fa998bd..a5d0b7d 100644 --- a/package.json +++ b/package.json @@ -10,25 +10,35 @@ "preview": "astro preview", "astro": "astro" }, - "bin": { - "linaro-astro-template": "bin/install.mjs" - }, "dependencies": { + "@astrojs/check": "^0.6.0", + "@astrojs/mdx": "^2.2.4", "@astrojs/sitemap": "^3.1.1", "@astrojs/solid-js": "^4.4.1", "@astrojs/tailwind": "^5.1.0", + "@auth/core": "^0.18.6", + "@biscuit-auth/biscuit-wasm": "^0.4.0", "@cloudinary/url-gen": "^1.21.0", "@fontsource/lato": "^5.0.17", "@iconify-json/mdi": "^1.1.64", + "@solid-primitives/scheduled": "^1.4.3", "@tailwindcss/typography": "^0.5.10", "astro": "^4.5.9", "astro-icon": "^1.1.0", "astro-navbar": "^2.3.1", + "astro-pagefind": "^1.4.0", "astro-seo": "^0.8.3", + "astro-sst": "^2.41.4", + "auth-astro": "^4.1.1", "dayjs": "^1.11.13", "marked": "^12.0.1", + "pagefind": "^1.1.0", + "remark": "^15.0.1", + "sharp": "^0.33.5", "solid-icons": "^1.1.0", "solid-js": "^1.8.22", + "sst": "^2.41.4", + "strip-markdown": "^6.0.0", "tailwindcss": "^3.4.1", "tw-elements": "^2.0.0", "vanilla-cookieconsent": "^2.9.2" @@ -36,6 +46,10 @@ "devDependencies": { "ora": "^7.0.1", "postcss": "^8.4.38", - "sass": "^1.69.5" + "prettier": "^3.3.3", + "prettier-plugin-astro": "^0.14.1", + "sass": "^1.69.5", + "tailwindcss-animated": "^1.1.2", + "typescript": "^5.6.2" } } diff --git a/src/assets/images/content/Mesadetrabajo13.png b/src/assets/images/hero-background.png similarity index 100% rename from src/assets/images/content/Mesadetrabajo13.png rename to src/assets/images/hero-background.png diff --git a/src/assets/images/linaro-logo-white.svg b/src/assets/images/linaro-logo-white.svg index 8725c49..0463d08 100644 --- a/src/assets/images/linaro-logo-white.svg +++ b/src/assets/images/linaro-logo-white.svg @@ -1 +1,9 @@ - \ No newline at end of file + + + + + + + + + diff --git a/src/components/footer/Footer.astro b/src/components/footer/Footer.astro index 2879fa6..bb6797b 100644 --- a/src/components/footer/Footer.astro +++ b/src/components/footer/Footer.astro @@ -1,64 +1,98 @@ --- import { getEntry } from "astro:content"; -import { Image } from "astro:assets"; -import { Icon } from 'astro-icon/components' -import LinaroLogo from "../../assets/images/linaro-logo-white.svg"; -const footer = await getEntry("data", "footer"); -const { data }: any = footer; +import CloudinaryImg from "../cloudinary/CloudinaryImg.astro"; +import SocialIcons from "./SocialIcons.astro"; +import { Icon } from "astro-icon/components"; + +const { + data: { nav_links, company_links }, +} = await getEntry("data", "footer"); + +const path = Astro.url.pathname; --- - diff --git a/src/components/footer/SocialIcons.astro b/src/components/footer/SocialIcons.astro new file mode 100644 index 0000000..f868147 --- /dev/null +++ b/src/components/footer/SocialIcons.astro @@ -0,0 +1,40 @@ +--- +import { Icon } from "astro-icon/components"; +import { getEntry } from "astro:content"; + +const {data: icons} = await getEntry('data', 'socials') + +type Props = { + size?: number; + color?: string; + outline?: boolean; + styles?: string; +}; + +const { size, color, outline, styles } = Astro.props; +const iconColor = color ? `text-${color}` : "text-white"; +const borderColor = color ? `border-${color}` : `border-white`; +--- + + diff --git a/src/components/head/BaseHead.astro b/src/components/head/BaseHead.astro index 67d94af..932dbca 100644 --- a/src/components/head/BaseHead.astro +++ b/src/components/head/BaseHead.astro @@ -60,4 +60,5 @@ const social_image = ""; ], }} /> + diff --git a/src/components/head/Cookies.astro b/src/components/head/Cookies.astro index 8752475..51a8f09 100644 --- a/src/components/head/Cookies.astro +++ b/src/components/head/Cookies.astro @@ -31,7 +31,7 @@ import "../../styles/cookies.scss"; ga("create", "", "auto"); // @ts-ignore ga("send", "pageview"); - } + }, ); } }, diff --git a/src/components/head/GoogleAnalytics.astro b/src/components/head/GoogleAnalytics.astro index 6c869bf..fdbb52e 100644 --- a/src/components/head/GoogleAnalytics.astro +++ b/src/components/head/GoogleAnalytics.astro @@ -8,10 +8,10 @@ const { id } = Astro.props; src={`https://www.googletagmanager.com/gtag/js?id=${id}`}> diff --git a/src/components/hero/Hero.astro b/src/components/hero/Hero.astro index 0acb873..19ef9e0 100644 --- a/src/components/hero/Hero.astro +++ b/src/components/hero/Hero.astro @@ -1,35 +1,30 @@ --- import { Image, getImage } from "astro:assets"; -import type { CollectionEntry } from "astro:content"; +import { getEntry } from "astro:content"; -type Props = CollectionEntry<"pages">["data"]["hero"]; - -const { title, background_image, style, inner_image, description } = Astro.props!; +import logo from "@/assets/images/linaro-logo-white.svg"; +const heroData = await getEntry("data", "hero"); --- -
- {inner_image ? {inner_image.alt} : <>} -

{title}

-

{description}

-
- - - +<> +
+ {heroData.data.inner_image.alt} +

{heroData.data.title}

+
+ + diff --git a/src/components/nav/NavBar.astro b/src/components/nav/NavBar.astro index 60dc670..5d6e768 100644 --- a/src/components/nav/NavBar.astro +++ b/src/components/nav/NavBar.astro @@ -3,7 +3,6 @@ import Dropdown from "./Dropdown.astro"; import { Astronav, MenuItems, MenuIcon } from "astro-navbar"; import { getEntry } from "astro:content"; import CloudinaryImg from "../cloudinary/CloudinaryImg.astro"; -import SearchModal from "../search/NavSearch/SearchModal.astro"; const navData = await getEntry("data", "nav"); --- @@ -64,19 +63,17 @@ const navData = await getEntry("data", "nav"); - ) + ), ) }
  • - -
    - Contact us -
    +
    +
    Contact us
  • -
  • + @@ -115,12 +112,12 @@ const navData = await getEntry("data", "nav"); const button = menu.querySelector("button"); button && button.addEventListener("click", (event) => - toggleDropdownMenu(event, menu, dropdownMenus) + toggleDropdownMenu(event, menu, dropdownMenus), ); // Handle Submenu Dropdowns const dropDownSubmenus = menu.querySelectorAll( - ".astronav-dropdown-submenu" + ".astronav-dropdown-submenu", ); dropDownSubmenus.forEach((submenu) => { @@ -174,11 +171,11 @@ const navData = await getEntry("data", "nav"); function closeAllDropdowns(event) { const dropdownMenus = document.querySelectorAll(".dropdown-toggle"); const dropdownParent = document.querySelectorAll( - ".astronav-dropdown, .astronav-dropdown-submenu" + ".astronav-dropdown, .astronav-dropdown-submenu", ); const isButtonInsideDropdown = [ ...document.querySelectorAll( - ".astronav-dropdown button, .astronav-dropdown-submenu button, #astronav-menu" + ".astronav-dropdown button, .astronav-dropdown-submenu button, #astronav-menu", ), ].some((button) => button.contains(event.target)); if (!isButtonInsideDropdown) { @@ -208,7 +205,7 @@ const navData = await getEntry("data", "nav"); dropdownToggle.classList.toggle("hidden"); dropdownToggle.setAttribute( "aria-expanded", - dropdownExpanded === "true" ? "false" : "true" + dropdownExpanded === "true" ? "false" : "true", ); } diff --git a/src/components/projects/Categories.astro b/src/components/projects/Categories.astro index ca56e1a..fb7d003 100644 --- a/src/components/projects/Categories.astro +++ b/src/components/projects/Categories.astro @@ -1,14 +1,22 @@ --- -import { getCollection } from "astro:content" -import ProjectListing from "./ProjectListing.astro" -const {item, posts} = Astro.props - +import { getCollection } from "astro:content"; +import ProjectListing from "./ProjectListing.astro"; +const { item, posts } = Astro.props; --- -
    -

    {item.label}

    -
    - {posts && posts.map((post: {data: {project: {title: string, logo: string}}}) => ( - - ))} -
    -
    \ No newline at end of file + +
    +
    +

    {item.label}

    +
    + { + posts && + posts.map( + (post: { data: { project: { title: string; logo: string } } }) => ( + + ), + ) + } +
    +
    diff --git a/src/components/projects/ProjectListing.astro b/src/components/projects/ProjectListing.astro index 6bbc542..a86ba47 100644 --- a/src/components/projects/ProjectListing.astro +++ b/src/components/projects/ProjectListing.astro @@ -1,15 +1,19 @@ --- import { Image } from "astro:assets"; -const {post} = Astro.props; +import type { CollectionEntry } from "astro:content"; // import logo from `${post.data.project.logo}`; +const { post } = Astro.props; +const logoUrl = post.data.project.logo; -const logoUrl = post.data.project.logo +console.log("listing post", Astro.props.post); --- -
    -
    - + diff --git a/src/components/search/NavSearch/NavResults.tsx b/src/components/search/NavSearch/NavResults.tsx deleted file mode 100644 index 1e68e97..0000000 --- a/src/components/search/NavSearch/NavResults.tsx +++ /dev/null @@ -1,132 +0,0 @@ -import dayjs from "dayjs"; -import { - createEffect, - createResource, - createSignal, - For, - Match, - Switch, - type Resource, -} from "solid-js"; - -const isDev = import.meta.env.DEV; - -const PAGE_SIZE = 5; - -const getArticle = async (result: any) => { - return await result.data(); -}; - -const getType = (type: "blogs" | "news" | "events" | "page") => { - switch (type) { - case "blogs": - return "Blog"; - case "news": - return "Newsroom"; - case "events": - return "Event"; - case "page": - return "Page"; - } -}; - -const NavResult = ({ result }: { result: any }) => { - const [article] = createResource(result, getArticle); - return ( -
  • - - - -
    -

    -

    - {article()?.meta.title} - {" | Linaro"} -

    - - {/*

    {article()?.meta.summary}

    */} -
    -
    - -
    -

    -

    - - {article()?.meta.title} - {" | "} - {getType(article().filters.type[0])} - {" | "} - {article()?.meta.author} - -

    -
    -
    - -
    -

    -

    - - {article()?.meta.title} - {" | "} - {getType(article().filters.type[0])} - {" | "} - {article()?.meta.dates} - {" | "} - {article()?.meta.location} - -

    -
    -
    -
    -
    -
  • - ); -}; - -const NavResults = ({ - results, -}: { - results: Resource; - onClearSearch: (e: Event) => void; -}) => { - const [page, setPage] = createSignal(1); - const [paginatedResults, setPaginatedResults] = createSignal([]); - - createEffect(() => { - setPaginatedResults(results()?.results.slice(0, page() * PAGE_SIZE) ?? []); - }); - - return ( -
    - - -
    Loading results...
    -
    - 0}> -
      - - {(result) => } - -
    -

    - Showing {paginatedResults().length} of {results().results.length}{" "} - results -

    -
    - -

    {results().results.length} results

    -
    -
    -
    - ); -}; - -export default NavResults; diff --git a/src/components/search/NavSearch/NavSearch.tsx b/src/components/search/NavSearch/NavSearch.tsx deleted file mode 100644 index 5af1e03..0000000 --- a/src/components/search/NavSearch/NavSearch.tsx +++ /dev/null @@ -1,99 +0,0 @@ -import { - createEffect, - createResource, - createSignal, - Show, - type JSX, - type ResourceFetcher, -} from "solid-js"; -import NavResults from "./NavResults"; -import { FaSolidXmark } from "solid-icons/fa"; - -const bundlePath = `${import.meta.env.BASE_URL}pagefind/`; -const pagefind = await import(/* @vite-ignore */ `${bundlePath}pagefind.js`); -pagefind.preload(""); -export type Filters = Record; - -export type SearchQuery = { query: string | null } | null; - -const fetchResults: ResourceFetcher = async ( - search -) => { - if (!search) return null; - return await pagefind.debouncedSearch(search.query, { - // filters: { type: ["page"] }, - }); -}; - -const NavSearch = () => { - const [search, setSearch] = createSignal(null); - const [results, { mutate }] = createResource(search, fetchResults); - - const onClearSearch = (e: Event) => { - e.preventDefault(); - setSearch(null); - mutate(null); - }; - - const onSubmit: JSX.EventHandler = (e) => { - e.preventDefault(); - if (e.target) { - const query = (e.target as any)[0].value; - const url = new URL(window.location.href); - url.pathname = "/search"; - if (query) { - url.searchParams.append("query", query); - } - window.location.href = url.href; - } - }; - - const onInput: JSX.InputEventHandler = (e) => { - if (!e.target.value || e.target.value === "") { - setSearch(null); - mutate(null); - return; - } - - setSearch({ - ...search(), - query: e.target.value ?? null, - }); - }; - - return ( -
    -
    -
    -
    - - -
    -
    - - -
    - -
    -
    -
    -
    - ); -}; - -export default NavSearch; diff --git a/src/components/search/NavSearch/SearchModal.astro b/src/components/search/NavSearch/SearchModal.astro deleted file mode 100644 index fd6fe63..0000000 --- a/src/components/search/NavSearch/SearchModal.astro +++ /dev/null @@ -1,71 +0,0 @@ ---- -import { Icon } from "astro-icon/components"; -import NavSearch from "./NavSearch"; - -const { id } = Astro.props; ---- - - - - -
    - -
    - -
    -
    -
    - - diff --git a/src/components/search/SiteResults.tsx b/src/components/search/SiteResults.tsx deleted file mode 100644 index 25d0ba8..0000000 --- a/src/components/search/SiteResults.tsx +++ /dev/null @@ -1,198 +0,0 @@ -import type { CollectionEntry } from "astro:content"; -import dayjs from "dayjs"; -import { - createEffect, - createResource, - createSignal, - For, - Match, - Show, - Switch, - type Resource, -} from "solid-js"; - -const isDev = import.meta.env.DEV; -const isSsr = import.meta.env.SSR; - -const PAGE_SIZE = 12; - -const getArticle = async (result: any) => { - return await result.data(); -}; - -const getType = (type: "blogs" | "news" | "events" | "page") => { - switch (type) { - case "blogs": - return "Blog"; - case "news": - return "Newsroom"; - case "events": - return "Event"; - case "page": - return "Page"; - } -}; - -const SiteResult = ({ - result, - tags, - isSsr, -}: { - result: any; - tags: CollectionEntry<"tags">[]; - isSsr: boolean; -}) => { - const [article] = createResource(result, getArticle); - - return ( -
  • - - - -
    -
    - -
    -
    -

    -

    - {article()?.meta.title} - {" | Linaro"} -

    -
    -
    -
    - -
    -
    - -
    -
    -

    -

    - - {article()?.meta.title} - {" | "} - {getType(article().filters.type[0])} - {" | "} - {article()?.meta.author} - -

    -
    -
    -
    - -
    -
    - -
    -
    -

    -

    - - {article()?.meta.title} - {" | "} - {getType(article().filters.type[0])} - {" | "} - {article()?.meta.dates} - {" | "} - {article()?.meta.location} - -

    -
    -
    -
    -
    -
    -
  • - ); -}; - -const BlogResults = ({ - results, - onClearSearch, - tags, - isSsr, -}: { - results: Resource; - onClearSearch: () => void; - tags: CollectionEntry<"tags">[]; - isSsr: boolean; -}) => { - const [page, setPage] = createSignal(1); - const [paginatedResults, setPaginatedResults] = createSignal([]); - - createEffect(() => { - setPaginatedResults(results()?.results.slice(0, page() * PAGE_SIZE) ?? []); - }); - - const onClickMore = () => { - setPage((prev) => prev + 1); - }; - - return ( -
    - - -
    Loading results...
    -
    - 0}> -

    {results()?.results.length} results

    -
      - - {(result) => ( - - )} - -
    -

    - Showing {paginatedResults().length} of {results().results.length}{" "} - results -

    - - - -
    - - -

    {results().results.length} results

    - - -
    -
    -
    - ); -}; - -export default BlogResults; diff --git a/src/components/search/SiteSearch.tsx b/src/components/search/SiteSearch.tsx deleted file mode 100644 index 199f712..0000000 --- a/src/components/search/SiteSearch.tsx +++ /dev/null @@ -1,141 +0,0 @@ -import "solid-js"; -import { - Show, - createEffect, - createMemo, - createResource, - createSignal, - type JSX, -} from "solid-js"; -import SiteResults from "./SiteResults"; -import { FaSolidChevronRight, FaSolidXmark } from "solid-icons/fa"; -import { AiFillTags } from "solid-icons/ai"; -import type { CollectionEntry } from "astro:content"; - -const bundlePath = `${import.meta.env.BASE_URL}pagefind/`; -const pagefind = await import(/* @vite-ignore */ `${bundlePath}pagefind.js`); - -export type Filters = Record; - -export type SearchQuery = { query: string | null; filters: Filters }; - -const fetchResults = async ({ - query, - filters, -}: { - query: string | null; - filters: Filters; -}) => { - return await pagefind.debouncedSearch(query, { - filters, - }); -}; - -const getQueryParams = ({ filters, query }: SearchQuery) => { - const url = new URL(window.location.origin + window.location.pathname); - if (query) url.searchParams.append("query", query); - if (filters.tags?.length > 0) { - url.searchParams.append("tags", filters.tags.join(",")); - } - - return url; -}; - -const SiteSearch = ({ - tags, - isSsr, -}: { - tags: CollectionEntry<"tags">[]; - isSsr: boolean; -}) => { - const pathParams = createMemo(() => { - const url_string = window.location.href; - const url = new URL(url_string); - return { - query: url.searchParams.get("query"), - }; - }); - - const [search, setSearch] = createSignal<{ - query: string | null; - filters: Filters; - }>({ - query: pathParams().query ?? null, - filters: { - type: [], - }, - }); - - const updateSearch = (newSearch: SearchQuery) => { - setSearch(newSearch); - const url = getQueryParams(newSearch); - window.history.pushState({}, "", url.toString()); - }; - - const onClearSearch = () => { - setSearch({ - query: null, - filters: { - type: [], - }, - }); - window.history.pushState( - {}, - "", - window.location.origin + window.location.pathname - ); - }; - - const onClearQuery = () => { - const newSearch = { - ...search(), - query: null, - }; - updateSearch(newSearch); - }; - - const [results] = createResource(search, fetchResults); - - return ( -
    -
    -
    { - e.preventDefault(); - }} - > - { - const value = e.target.value === "" ? null : e.target.value; - setSearch({ - ...search(), - query: value ?? null, - }); - }} - class="w-full h-full px-3 w-full h-full px-1 bg-background outline-none" - /> - -
    -
    - -
    - ); -}; - -export default SiteSearch; diff --git a/src/components/sections/Projects.astro b/src/components/sections/Projects.astro index 47db87a..fe7b9f5 100644 --- a/src/components/sections/Projects.astro +++ b/src/components/sections/Projects.astro @@ -3,39 +3,63 @@ import { getEntry } from "astro:content"; import Categories from "../projects/Categories.astro"; import { getCollection } from "astro:content"; -const {data: categories} = await getEntry("data", "categories"); +const { data: categories } = await getEntry("data", "categories"); // const allPosts = await getCollection('posts'); -const osPosts = await getCollection('posts', ({data}) => { return data.category === 'os'}); -const librariesPosts = await getCollection('posts', ({data}) => { return data.category === 'libraries'}); -const middlewarePosts = await getCollection('posts', ({data}) => { return data.category === 'middleware'}); -const bigDataPosts = await getCollection('posts', ({data}) => { return data.category === 'bigdata'}); -const webPosts = await getCollection('posts', ({data}) => { return data.category === 'web'}); -const hpcPosts = await getCollection('posts', ({data}) => { return data.category === 'hpc'}); -const aiPosts = await getCollection('posts', ({data}) => { return data.category === 'ai'}); -const cloudPosts = await getCollection('posts', ({data}) => { return data.category === 'cloud'}); -const databasePosts = await getCollection('posts', ({data}) => { return data.category === 'database'}); -const storagePosts = await getCollection('posts', ({data}) => { return data.category === 'storage'}); +const osPosts = await getCollection("posts", ({ data }) => { + return data.category === "os"; +}); +const librariesPosts = await getCollection("posts", ({ data }) => { + return data.category === "libraries"; +}); +const middlewarePosts = await getCollection("posts", ({ data }) => { + return data.category === "middleware"; +}); +const bigDataPosts = await getCollection("posts", ({ data }) => { + return data.category === "bigdata"; +}); +const webPosts = await getCollection("posts", ({ data }) => { + return data.category === "web"; +}); +const hpcPosts = await getCollection("posts", ({ data }) => { + return data.category === "hpc"; +}); +const aiPosts = await getCollection("posts", ({ data }) => { + return data.category === "ai"; +}); +const cloudPosts = await getCollection("posts", ({ data }) => { + return data.category === "cloud"; +}); +const databasePosts = await getCollection("posts", ({ data }) => { + return data.category === "database"; +}); +const storagePosts = await getCollection("posts", ({ data }) => { + return data.category === "storage"; +}); // try by mapping all posts and see which is faster const postsByCategory = { - os: osPosts, - middleware:middlewarePosts, - libraries: librariesPosts, - bigdata: bigDataPosts, - web: webPosts, - hpc: hpcPosts, - ai: aiPosts, - cloud: cloudPosts, - database: databasePosts, - storage: storagePosts -} - + os: osPosts, + middleware: middlewarePosts, + libraries: librariesPosts, + bigdata: bigDataPosts, + web: webPosts, + hpc: hpcPosts, + ai: aiPosts, + cloud: cloudPosts, + database: databasePosts, + storage: storagePosts, +}; ---
    -
    - { categories.map((item: {name: string, label: string}) => ( - - ))} -
    -
    \ No newline at end of file +
    + { + categories.map((item: { name: string; label: string }) => ( + + )) + } +
    + diff --git a/src/components/sections/Text.astro b/src/components/sections/Text.astro index d8613fb..8c6f817 100644 --- a/src/components/sections/Text.astro +++ b/src/components/sections/Text.astro @@ -4,6 +4,4 @@ import * as marked from "marked"; const markdown = marked.parse(text_content.text); --- -
    -

    -

    +
    diff --git a/src/content/config.ts b/src/content/config.ts index f18b4ff..4d764f2 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -28,9 +28,9 @@ const pages = defineCollection({ .object({ component: reference("sections"), }) - .catchall(z.any()) + .catchall(z.any()), ), - }) + }), ) .optional(), }), @@ -56,9 +56,9 @@ const data = defineCollection({ }); const posts = defineCollection({ - type: 'content', - schema: z.any() -}) + type: "content", + schema: z.any(), +}); // Expose your defined collection to Astro // with the `collections` export @@ -67,5 +67,5 @@ export const collections = { rows, sections, data, - posts + posts, }; diff --git a/src/content/data/categories.yml b/src/content/data/categories.yml index c2aa404..c6528e6 100644 --- a/src/content/data/categories.yml +++ b/src/content/data/categories.yml @@ -17,7 +17,7 @@ label: Big Data image: /assets/images/content/DataCenter.jpg - name: ai - Label: Artificial Intelligence + label: Artificial Intelligence image: /assets/images/content/AI.png - name: libraries label: Programming Language, Libraries & Toolchain diff --git a/src/content/data/footer.yaml b/src/content/data/footer.yaml index 290979b..49d5d66 100644 --- a/src/content/data/footer.yaml +++ b/src/content/data/footer.yaml @@ -13,5 +13,8 @@ footer_brand: social_media_icons: false # These links are displayed at the very bottom of the footer. company_links: - - name: Contact + - label: Contact url: https://www.linaro.org/contact/ + - label: Legal + url: https://www.linaro.org/legal +nav_links: \ No newline at end of file diff --git a/src/content/data/hero.yml b/src/content/data/hero.yml new file mode 100644 index 0000000..87ecf7b --- /dev/null +++ b/src/content/data/hero.yml @@ -0,0 +1,6 @@ +inner_image: + src: "../../assets/images/linaro-logo-white.svg" + alt: Linaro logo +style: text-center text-linaro-yellow bg-linaro-gradient flex flex-col items-center justify-center px-5 h-128 +title: Ecosystem Dashboard +background_image: ../../assets/images/hero-background.png diff --git a/src/content/data/socials.yaml b/src/content/data/socials.yaml new file mode 100644 index 0000000..92e2e27 --- /dev/null +++ b/src/content/data/socials.yaml @@ -0,0 +1,12 @@ +- label: X + icon: X + url: https://x.com/linaroorg +- label: Facebook + icon: facebook + url: https://www.facebook.com/LinaroOrg +- label: LinkedIn + icon: linkedin + url: https://www.linkedin.com/company/linaro +- label: YouTube + icon: youtube + url: https://www.youtube.com/linaroorg \ No newline at end of file diff --git a/src/content/pages/homepage.md b/src/content/pages/homepage.md index 349a7bf..edb7bd7 100644 --- a/src/content/pages/homepage.md +++ b/src/content/pages/homepage.md @@ -4,41 +4,22 @@ slug: "" title: Linaro Ecosystem Dashboard description: > The Linaro Ecosystem Dashboard has been created to provide a centralized information hub for Arm developers across the world. -hero: - # title: Homepage Hero Text - # background_image: "../../assets/images/hero.jpg" - # inner_image: - # src: "../../assets/images/linaro-logo-white.svg" - # alt: Linaro logo - # style: text-center uppercase - - style: text-center font-weight-bold - title: Ecosystem Dashboard - background_image: ../../assets/images/content/Mesadetrabajo13.png flow: - row: container_row - style: sections: - # - component: title - # style: text-center - # title_content: - # style: font-bold - # size: h2 - # text: Welcome to linaro-astro-template - component: text - style: text-center text-color-white text_content: - text: |- - The hub for all Arm developers across the world - - Click the projects' logos to check Arm support details - - Want to submit a project?  - - Click here for guidelines and instructions first + text: The hub for all Arm developers across the world + style: text-center text-5xl mt-16 + - component: text + text_content: + text: Click the projects' logos to check Arm support details + style: text-center text-2xl mt-16 + - component: text + text_content: + text: Want to submit a project?
    [Click here](https://github.com/Linaro/ecosystemlandscape#project-details-structure) for guidelines and instructions first + style: text-center text-2xl mb-0 mt-8 - row: container_row sections: - component: projects --- - -12 diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 5e1a1a0..d79d588 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -2,6 +2,7 @@ import BaseHead from "@/components/head/BaseHead.astro"; import NavBar from "@/components/nav/NavBar.astro"; import Footer from "@/components/footer/Footer.astro"; +import Hero from "@/components/hero/Hero.astro"; interface Props { title: string; @@ -16,9 +17,8 @@ const { title, description, type = "website" } = Astro.props; +