Skip to content

Commit bc57ae9

Browse files
committed
added a new query param: showBorder
1 parent 50e8aef commit bc57ae9

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ Use [this](https://github-readme-tech-stack.vercel.app) website to customize a c
4545
> **Note**
4646
> These cards use [shields.io](https://shields.io/) badges under the hood.
4747
48+
> **Warning**
49+
> If the site doesn't load and displays a full white screen, try it in incognito mode.
50+
4851
<hr>
4952

5053
## 🔨 Query parameters
@@ -55,8 +58,9 @@ We suggest not editing the query parameters manually, use [our website](https://
5558
| **title** | `?title=My%20Custom%20Title` | My Tech Stack | The title of the card. %20 can be used as a space. |
5659
| **theme** | `?theme=github_dark` | github | The theme of the card. You can browse between the themes [here](#-themes). |
5760
| **align** | `?align=center` | left | The alignment of the badges. (`left`, `center`, `right`) |
61+
| **showBorder** | `?showBorder=false` | true | Display the border around the card or not. (`true`, `false`) |
5862
| **lineCount** | `?lineCount=2` | 1 | The number of lines you want to add to your card. |
59-
| **line{n}** | `?line1=typescript,typescript,2D79C7` | - | The current line of the badge, where {n} is a number. *`(1 <= n <= lineCount)`* Learn how to create a line like this [here](#-how-to-customize-a-line). |
63+
| **line{n}** | `?line1=typescript,typescript,2D79C7` | - | The current line of the badge, where {n} is a number. *`(1 <= n <= lineCount)`* |
6064

6165
<hr>
6266

client/src/components/popups/LinePopup.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,3 @@ const LinePopup: FC<LinePopupProps> = (props) => {
152152
};
153153

154154
export default LinePopup;
155-

src/cards/card.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ export default class Card {
66
private lineCount: number;
77
private theme: Theme;
88
private badgeAlign: BadgeAlign;
9+
private showBorder: boolean;
910

1011
private lines: Map<number, Badge[]>;
1112

1213
public constructor() {
1314
this.title = "My Tech Stack";
1415
this.theme = getThemeByName("github");
1516
this.badgeAlign = "left";
17+
this.showBorder = true;
1618

1719
this.lineCount = 1;
1820
this.lines = new Map<number, Badge[]>();
@@ -60,4 +62,10 @@ export default class Card {
6062
public setBadgeAlign = (badgeAlign: BadgeAlign): void => {
6163
this.badgeAlign = badgeAlign;
6264
};
65+
66+
public getShowBorder = (): boolean => this.showBorder;
67+
68+
public setShowBorder = (showBorder: boolean): void => {
69+
this.showBorder = showBorder;
70+
};
6371
}

src/controllers/cards-controller.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ export const getCard = async (req: Request, res: Response) => {
1515
const theme = req.query.theme?.toString() || "";
1616
const lineCount = req.query.lineCount?.toString() || "1";
1717
const align = req.query.align?.toString() || "left";
18+
const showBorder = req.query.showBorder?.toString() || "true";
1819

1920
card.setTitle(title);
2021
card.setTheme(getThemeByName(theme));
2122
card.setLineCount(validateLineCount(lineCount));
2223
card.setBadgeAlign(validateAlign(align));
24+
card.setShowBorder(showBorder !== "false");
2325

2426
// run a loop card.getLineCount() times
2527
for (let i = 1; i <= card.getLineCount(); i++) {

src/svg/svg-generator.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,19 @@ export default class SvgGenerator {
3333
fill="none"
3434
xmlns="http://www.w3.org/2000/svg"
3535
role="img"
36-
aria-label="My Tech Stack"
36+
aria-label="${this.card.getTitle()}"
3737
>
3838
<title>${this.card.getTitle()}</title>
3939
4040
<rect
41-
x="0.5"
42-
y="0.5"
41+
x="${this.card.getShowBorder() ? 0.5 : 0}"
42+
y="${this.card.getShowBorder() ? 0.5 : 0}"
4343
rx="4.5"
44-
height="${this.height - 1}"
44+
height="${this.height - (this.card.getShowBorder() ? 1 : 0)}"
4545
stroke="${this.card.getTheme().borderColor}"
46-
width="${this.width - 1}"
46+
width="${this.width - (this.card.getShowBorder() ? 1 : 0)}"
4747
fill="${this.card.getTheme().backgroundColor}"
48-
stroke-opacity="1"
48+
stroke-opacity="${this.card.getShowBorder() ? 1 : 0}"
4949
/>
5050
5151
<g transform="translate(25, 35)">

0 commit comments

Comments
 (0)