Skip to content

Commit f4192a5

Browse files
committed
client(badges): the badge name and the label gets uri encoded on generate
1 parent 11b05e2 commit f4192a5

File tree

4 files changed

+12
-15
lines changed

4 files changed

+12
-15
lines changed

client/src/components/input/LineInput.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ const LineInput: FC<InputProps> = (props) => {
3333

3434
return (
3535
<div className={`${props.className} w-full flex flex-col gap-1 text-sm`}>
36-
<BlurOverlay
37-
isActive={isPopupOpen}
38-
closePopup={() => setIsPopupOpen(false)}
39-
/>
36+
<BlurOverlay isActive={isPopupOpen} />
4037

4138
<LinePopup
4239
addBadge={addBadge}
@@ -127,7 +124,9 @@ const LineInput: FC<InputProps> = (props) => {
127124
(e.target as HTMLImageElement).style.display = "none";
128125
}}
129126
className="w-4 h-4"
130-
src={`https://cdn.simpleicons.org/${badge.iconName}/${
127+
src={`https://cdn.simpleicons.org/${encodeURI(
128+
badge.iconName
129+
)}/${
131130
badge.color === "auto" ? "" : badge.color.replace("#", "")
132131
}`}
133132
alt=""

client/src/components/popups/BlurOverlay.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
import { FC, useEffect } from "react";
1+
import { FC } from "react";
22

33
interface OverlayProps {
44
isActive: boolean;
5-
closePopup?: () => void;
65
}
76

87
const BlurOverlay: FC<OverlayProps> = (props) => {
9-
useEffect(() => {
10-
document.body.style.overflow = props.isActive ? "hidden" : "auto";
11-
}, [props.isActive]);
12-
138
return (
149
<div
1510
className={`w-screen h-screen fixed top-0 left-0 transition-all duration-300
16-
z-20 ${props.isActive ? "backdrop-blur-sm" : "pointer-events-none"}`}
17-
onClick={props.closePopup}
11+
z-20 ${
12+
props.isActive
13+
? "backdrop-blur-sm bg-black/[.5]"
14+
: "pointer-events-none"
15+
}`}
1816
/>
1917
);
2018
};

client/src/components/popups/LinePopup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const LinePopup: FC<LinePopupProps> = (props) => {
3939
};
4040

4141
const activeClasses = "opacity-100 pointer-events-auto scale-100";
42-
const inactiveClasses = "opacity-0 pointer-events-none scale-0";
42+
const inactiveClasses = "opacity-0 pointer-events-none scale-50";
4343

4444
return (
4545
<div

client/src/utils/generate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export const generateLink = ({
183183
let line = `&line${l.lineNumber}=`;
184184
for (const b of l.badges) {
185185
const color = b.color.replace("#", "");
186-
line += `${b.iconName},${b.label},${color};`;
186+
line += `${encodeURI(b.iconName)},${encodeURI(b.label)},${color};`;
187187
}
188188

189189
res += line;

0 commit comments

Comments
 (0)