Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Tag tweaks

Matt Robertse2320513d051
diff --git a/public/assets/images/heroicons-shieldcheck.svg b/public/assets/images/heroicons-shieldcheck.svg
new file mode 100644
index 000000000..1b8614277
--- /dev/null
+++ b/public/assets/images/heroicons-shieldcheck.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
+ <path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z" />
+</svg>
diff --git a/public/components/ShowTag.scss b/public/components/ShowTag.scss
index ef59e941c..352d9049d 100644
--- a/public/components/ShowTag.scss
+++ b/public/components/ShowTag.scss
@@ -7,7 +7,7 @@
font-size: 13px;
color: get("colors.gray.900");
background-color: get("colors.gray.200");
- font-weight: 600;
+ font-weight: 500;
border-radius: 5px;
// line-height: 18px;
padding: 6px 10px;
@@ -30,11 +30,6 @@
display: inline-block;
}
- svg {
- height: 8px;
- margin-right: 2px;
- }
-
&--circular {
min-height: 0;
min-width: 0;
diff --git a/public/components/ShowTag.tsx b/public/components/ShowTag.tsx
index 427ca509d..b00a6c29f 100644
--- a/public/components/ShowTag.tsx
+++ b/public/components/ShowTag.tsx
@@ -3,6 +3,8 @@ import "./ShowTag.scss"
import React from "react"
import { Tag } from "@fider/models"
import { classSet } from "@fider/services"
+import ShieldCheck from "@fider/assets/images/heroicons-shieldcheck.svg"
+import { Icon } from "./common"
interface TagProps {
tag: Tag
@@ -10,18 +12,6 @@ interface TagProps {
link?: boolean
}
-const getRGB = (color: string) => {
- const r = color.substring(0, 2)
- const g = color.substring(2, 4)
- const b = color.substring(4, 6)
-
- return {
- R: parseInt(r, 16),
- G: parseInt(g, 16),
- B: parseInt(b, 16),
- }
-}
-
// const textColor = (color: string) => {
// const components = getRGB(color)
// const bgDelta = components.R * 0.299 + components.G * 0.587 + components.B * 0.114
@@ -34,16 +24,6 @@ export const ShowTag = (props: TagProps) => {
"c-tag--circular": props.circular === true,
})
- const darkenColor = (color: string) => {
- const components = getRGB(color)
- const darkerR = Math.floor(components.R * 0.8)
- const darkerG = Math.floor(components.G * 0.8)
- const darkerB = Math.floor(components.B * 0.8)
- return `${darkerR.toString(16).padStart(2, "0")}${darkerG.toString(16).padStart(2, "0")}${darkerB.toString(16).padStart(2, "0")}`
- }
-
- const darkerColor = darkenColor(props.tag.color)
-
return (
<a
href={props.link && props.tag.slug ? `/?tags=${props.tag.slug}` : undefined}
@@ -53,18 +33,9 @@ export const ShowTag = (props: TagProps) => {
<span
style={{
backgroundColor: `#${props.tag.color}`,
- border: `1px solid #${darkerColor}`,
}}
></span>
- {!props.tag.isPublic && !props.circular && (
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
- <path
- fillRule="evenodd"
- d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z"
- clipRule="evenodd"
- />
- </svg>
- )}
+ {!props.tag.isPublic && !props.circular && <Icon height="14" width="14" sprite={ShieldCheck} className="mr-1" />}
{props.circular ? "" : props.tag.name || "Tag"}
</a>
)