From 18a6465a58fe7e59fdf089dcc7920e6c44d46ccb Mon Sep 17 00:00:00 2001 From: Jordan Roher Date: Sat, 22 Apr 2023 14:50:09 -0700 Subject: [PATCH 1/2] Added the ability to set links to open in the same window --- docker-entrypoint.sh | 1 + dockerfile | 1 + readme.md | 1 + src/components/anchor.tsx | 24 ++++++++++++++++++++++++ src/components/icon.tsx | 9 +++++---- src/components/services.tsx | 9 +++------ src/variables.ts | 1 + version | 2 +- 8 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 src/components/anchor.tsx diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 7b4d62f..0fe6c00 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -13,6 +13,7 @@ sed -i -e 's/SHOWHEADER = true/SHOWHEADER = '"${HEADER}"'/g' /app/src/variables. sed -i -e 's/SHOWHEADERLINE = true/SHOWHEADERLINE = '"${HEADERLINE}"'/g' /app/src/variables.ts sed -i -e 's/SHOWHEADERTOP = false/SHOWHEADERTOP = '"${HEADERTOP}"'/g' /app/src/variables.ts sed -i -e 's/CATEGORIES = "normal"/CATEGORIES = "'"${CATEGORIES}"'"/g' /app/src/variables.ts +sed -i -e 's/NEWWINDOW = true/NEWWINDOW = '"${NEWWINDOW}"'/g' /app/src/variables.ts # CSS replacement sed -i -e 's/background-color: theme(\(colors\.slate\.50\))/background-color: '"${BGCOLOR}"'/g' /app/src/tailwind.css diff --git a/dockerfile b/dockerfile index 02c0bcc..bf47706 100644 --- a/dockerfile +++ b/dockerfile @@ -26,6 +26,7 @@ ENV HEADERTOP "false" ENV CATEGORIES "normal" ENV BGCOLOR "theme(colors.slate.50)" ENV BGCOLORDARK "theme(colors.gray.950)" +ENV NEWWINDOW "true" COPY version / diff --git a/readme.md b/readme.md index 4e402a9..9cceb7f 100644 --- a/readme.md +++ b/readme.md @@ -95,6 +95,7 @@ services: - CATEGORIES=small # defaults to normal, set to small for smaller, uppercase category labels - BGCOLOR=#fff # defaults to theme(colors.slate.50), set to any hex color or Tailwind color using the theme syntax - BGCOLORDARK=#000 # defaults to theme(colors.gray.950), set to any hex color or Tailwind color using the theme syntax + - NEWWINDOW=true # defaults to true, set to false to not have links open in a new window volumes: - ./config.json:/app/src/config.json # required - ./public/favicon.ico:/app/public/favicon.ico # optional diff --git a/src/components/anchor.tsx b/src/components/anchor.tsx new file mode 100644 index 0000000..66e98c9 --- /dev/null +++ b/src/components/anchor.tsx @@ -0,0 +1,24 @@ +import React from "react"; +import { NEWWINDOW } from "../variables"; + +interface IProps { + uri: string; + title?: string; + children?: React.ReactNode; +} + +export const Anchor: React.FunctionComponent = ({ uri, children, title }) => { + if (NEWWINDOW) { + return ( + + {children} + + ); + } + + return ( + + {children} + + ); +}; diff --git a/src/components/icon.tsx b/src/components/icon.tsx index dc2fa49..4cf49ee 100644 --- a/src/components/icon.tsx +++ b/src/components/icon.tsx @@ -1,5 +1,6 @@ import React from "react"; import { is } from "../shared/is"; +import { Anchor } from "./anchor"; const iconColors = [ "blue", @@ -36,9 +37,9 @@ export const Icon: React.FunctionComponent = ({ name, uri, icon, index, if (is.null(icon)) { if (!is.null(uri)) { return ( - + - + ); } @@ -47,9 +48,9 @@ export const Icon: React.FunctionComponent = ({ name, uri, icon, index, if (!is.null(uri)) { return ( - + - + ); } diff --git a/src/components/services.tsx b/src/components/services.tsx index 1877b00..c1dfb12 100644 --- a/src/components/services.tsx +++ b/src/components/services.tsx @@ -1,6 +1,7 @@ import React from "react"; import { is } from "../shared/is"; import { IService } from "../shared/types"; +import { Anchor } from "./anchor"; import { Icon } from "./icon"; interface IServicesProps { @@ -42,15 +43,11 @@ const Service: React.FunctionComponent = ({ service, index }) => )}

- - {name} - + {name}

{!is.null(description) && (

- - {description} - + {description}

)}
diff --git a/src/variables.ts b/src/variables.ts index 2cacc82..86256ef 100644 --- a/src/variables.ts +++ b/src/variables.ts @@ -5,3 +5,4 @@ export const SHOWHEADERLINE = true; export const SHOWHEADERTOP = false; export const CATEGORIES = "normal"; export const THEME = "light"; +export const NEWWINDOW = true; diff --git a/version b/version index 8cfbc90..8428158 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.1.1 \ No newline at end of file +1.1.2 \ No newline at end of file From cdc6f21168c0b8d761a54b489601d1d300765b77 Mon Sep 17 00:00:00 2001 From: Jordan Roher Date: Sat, 22 Apr 2023 14:50:34 -0700 Subject: [PATCH 2/2] Spaces --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 9cceb7f..6f19eb8 100644 --- a/readme.md +++ b/readme.md @@ -95,7 +95,7 @@ services: - CATEGORIES=small # defaults to normal, set to small for smaller, uppercase category labels - BGCOLOR=#fff # defaults to theme(colors.slate.50), set to any hex color or Tailwind color using the theme syntax - BGCOLORDARK=#000 # defaults to theme(colors.gray.950), set to any hex color or Tailwind color using the theme syntax - - NEWWINDOW=true # defaults to true, set to false to not have links open in a new window + - NEWWINDOW=true # defaults to true, set to false to not have links open in a new window volumes: - ./config.json:/app/src/config.json # required - ./public/favicon.ico:/app/public/favicon.ico # optional