Skip to content

Commit 3e6ab2e

Browse files
committed
client(Options.tsx): add a new input field for the hideBg query parameter
1 parent 1da35d4 commit 3e6ab2e

File tree

11 files changed

+49
-32
lines changed

11 files changed

+49
-32
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ The easiest way to start using these cards is to visit our website, where you ca
4848
## 🔧 Query parameters
4949
None of the fields are required. Every query parameter has a default value displayed below.
5050

51-
> **Note**
52-
> Not every query parameter is changeable on the Demo Website.
53-
5451
| Parameter | Example | Default value | Description |
5552
|---------- |---------|---------------|------------ |
5653
| **title** | `?title=My%20Title` | My Tech Stack | The title of the card. `%20` can be used as a space. |
@@ -74,6 +71,7 @@ None of the fields are required. Every query parameter has a default value displ
7471
These cards come with several built-in themes you can use. You can find all of them by clicking [here](docs/THEMES.md).
7572
If you would like to use other themes, and add one for yourself and others, please check this [issue](https://github.com/0l1v3rr/github-readme-tech-stack/issues/2).
7673

74+
### 🖌 Customizing a theme
7775
You can customize a theme using these query parameters.
7876
These parameters accept only valid hexadecimal colors, otherwise, they are not applied. Please use `%23` instead of `#`.
7977

client/build/asset-manifest.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/build/index.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/build/static/js/main.ba7571ef.js renamed to client/build/static/js/main.d018c227.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/build/static/js/main.ba7571ef.js.map renamed to client/build/static/js/main.d018c227.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/src/pages/Options.tsx

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -133,24 +133,6 @@ const Options: FC<OptionsProps> = (props) => {
133133
validate={(val) => validateFontFamily(val)}
134134
/>
135135

136-
<div className="flex items-start gap-4">
137-
<TrueFalseInput
138-
label="Border"
139-
value={card.showBorder}
140-
setValue={(v) =>
141-
setCard({ ...card, showBorder: v, lines: card.lines })
142-
}
143-
/>
144-
145-
<NumberInput
146-
label="Lines"
147-
value={`${card.lines.length}`}
148-
setValue={(v) => updateLineCount(Number(v))}
149-
minValue={1}
150-
maxValue={5}
151-
/>
152-
</div>
153-
154136
<div className="flex items-start gap-4">
155137
<NumberInput
156138
label="Gap"
@@ -170,11 +152,35 @@ const Options: FC<OptionsProps> = (props) => {
170152
maxValue={30}
171153
/>
172154
</div>
155+
156+
<div className="flex items-start gap-4">
157+
<TrueFalseInput
158+
label="Show Border"
159+
value={card.showBorder}
160+
setValue={(v) =>
161+
setCard({ ...card, showBorder: v, lines: card.lines })
162+
}
163+
/>
164+
165+
<TrueFalseInput
166+
label="Hide Background"
167+
value={card.hideBg}
168+
setValue={(v) => setCard({ ...card, hideBg: v, lines: card.lines })}
169+
/>
170+
</div>
173171
</div>
174172

175173
<div className="my-4 flex flex-col gap-4 px-4">
176174
<div className="w-full h-[.8px] bg-gh-border mx-auto" />
177175

176+
<NumberInput
177+
label="Line Count"
178+
value={`${card.lines.length}`}
179+
setValue={(v) => updateLineCount(Number(v))}
180+
minValue={1}
181+
maxValue={5}
182+
/>
183+
178184
{card.lines.map((line) => (
179185
<LineInput
180186
line={line}

client/src/types/card.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export interface Card {
2020
theme: string;
2121
align: string;
2222
showBorder: boolean;
23+
hideBg: boolean;
2324
borderRadius: string;
2425
fontWeight: string;
2526
fontSize: string;
@@ -42,5 +43,6 @@ export const newCard = (): Card => {
4243
title: "My Tech Stack",
4344
lineHeight: "7",
4445
gap: "10",
46+
hideBg: false,
4547
};
4648
};

client/src/utils/generate.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ class UrlBuilder {
3636
return this;
3737
}
3838

39+
public hideBg(hideBg: boolean): UrlBuilder {
40+
if (hideBg === this.defaultCard.hideBg) {
41+
return this;
42+
}
43+
44+
this.url += `hideBg=${hideBg}&`;
45+
return this;
46+
}
47+
3948
public align(align: string): UrlBuilder {
4049
if (align === this.defaultCard.align) {
4150
return this;
@@ -126,6 +135,7 @@ export const generateLink = ({
126135
fontFamily,
127136
lineHeight,
128137
gap,
138+
hideBg,
129139
}: Card): string => {
130140
let res = new UrlBuilder()
131141
.title(title)
@@ -139,6 +149,7 @@ export const generateLink = ({
139149
.lineCount(lines.length)
140150
.theme(theme)
141151
.gap(gap)
152+
.hideBg(hideBg)
142153
.build();
143154

144155
for (const l of lines) {

client/src/utils/validate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export const validateIconAndLabel = (
1616
val: string,
1717
iorl: "icon" | "label"
1818
): string => {
19-
if (val.length < 3 || val.length > 32) {
20-
return `The ${iorl} should be between 2 and 32 characters.`;
19+
if (val.length < 2 || val.length > 32) {
20+
return `The ${iorl} should be between 1 and 32 characters.`;
2121
}
2222

2323
return "";

0 commit comments

Comments
 (0)