From 45a303a947a295974303b267d5c6b4e81b109a92 Mon Sep 17 00:00:00 2001 From: Seth Etter Date: Sun, 13 Oct 2024 15:11:58 -0500 Subject: [PATCH] update styles on projects page --- islands/Footer.tsx | 6 +-- islands/IssuesList.tsx | 86 +++++++++++++++++++++++++++--------------- tailwind.config.ts | 24 ++++++++++++ 3 files changed, 82 insertions(+), 34 deletions(-) diff --git a/islands/Footer.tsx b/islands/Footer.tsx index f1f88ad..ce6ef55 100644 --- a/islands/Footer.tsx +++ b/islands/Footer.tsx @@ -13,7 +13,7 @@ export const Footer = () => { href="https://github.com/devict/help" target="_blank" rel="noopener noreferrer" - class="text-md font-medium underline text-blue-600 hover:text-blue-800 visited:text-purple-600" + class="text-md font-medium" > GitHub @@ -35,7 +35,7 @@ export const Footer = () => { Code of Conduct @@ -43,7 +43,7 @@ export const Footer = () => { Report an Incident diff --git a/islands/IssuesList.tsx b/islands/IssuesList.tsx index ce575f4..2aeeb75 100644 --- a/islands/IssuesList.tsx +++ b/islands/IssuesList.tsx @@ -26,8 +26,11 @@ const IssuesList = ({ repos, issues }: Props) => { return ( setLabelFilter(label)} - style={"background-color: #".concat(label.color)} - class="cursor-pointer font-bold mr-1 mb-1 w-fit px-2 py-[0.125rem] rounded-xl text-white text-xxs whitespace-nowrap hover:text-black" + style={{ + backgroundColor: `#${label.color}`, + color: parseInt(label.color, 16) > 0xffffff / 2 ? "#000" : "#fff", + }} + class="cursor-pointer font-semibold mr-1 px-2 py-[0.125rem] rounded-full text-[10px] whitespace-nowrap hover:opacity-80 transition-opacity" > {label.name} @@ -46,50 +49,71 @@ const IssuesList = ({ repos, issues }: Props) => { return !(isFilteredByRepo || isFilteredByLabel); }), [issues, repoFilter, labelFilter]); + const groupedIssues = useMemo(() => { + const groups: Record = {}; + filteredIssues.forEach((issue) => { + const repoPath = issueRepoPath(issue); + if (!groups[repoPath]) { + groups[repoPath] = []; + } + groups[repoPath].push(issue); + }); + return groups; + }, [filteredIssues]); + return ( -
-
+
+
- + {labelFilter ? <>Labeled with: {showLabel({ ...labelFilter })} - : ( - "Click a label to filter issues" - )} + : "Click a label to filter issues"}
+ {(repoFilter !== NO_FILTER || labelFilter) && ( + + )}
- {(repoFilter !== NO_FILTER || labelFilter) && ( - - )} -
    - {filteredIssues.map((issue) => ( -
  • - -
    - {issue.labels.map((label) => showLabel(label))} -
    -
  • +
    + {Object.entries(groupedIssues).map(([repoPath, repoIssues]) => ( +
    +

    {repoPath}

    +
      + {repoIssues.map((issue) => ( +
    • + + {issue.title} + +
      + {issue.labels.map((label) => showLabel(label))} +
      +
    • + ))} +
    +
    ))} -
+
); }; diff --git a/tailwind.config.ts b/tailwind.config.ts index c16b31b..9892a36 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -1,4 +1,5 @@ import { type Config } from "tailwindcss"; +import plugin from "tailwindcss/plugin"; // Requires Fresh AOT builds to pre-compile tailwind classes to CSS // https://fresh.deno.dev/docs/examples/migrating-to-tailwind#requirements-before-migrating @@ -6,4 +7,27 @@ export default { content: [ "{routes,islands,components}/**/*.{ts,tsx}", ], + theme: { + extend: { + textColor: { + "link": "#718096", // Slate-500 (lighter than before) + "link-hover": "#2D3748", // Slate-800 (unchanged) + }, + }, + }, + plugins: [ + plugin(({ addBase, theme }) => { + addBase({ + "a": { + color: theme("textColor.link"), + textDecoration: "none", + fontWeight: "500", + transition: "color 0.2s ease-in-out", + }, + "a:hover": { + color: theme("textColor.link-hover"), + }, + }); + }), + ], } satisfies Config; -- 2.51.2