Skip to content

Commit

Permalink
feat: add location (hardcoded)
Browse files Browse the repository at this point in the history
  • Loading branch information
isqua committed Jun 1, 2024
1 parent ac3c3a7 commit ce20b08
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
14 changes: 12 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,28 @@
fill: #fefefd;
}
.camp-outline,
.camp-side {
.camp-side,
.location {
fill: #3986cf;
}
</style>

<rect class="background" width="100%" height="100%" />
<g class="stripes"></g>
<path class="camp-side" d="M1145 124h-25l52-70v42z" />
<path
class="camp-outline"
d="M1124 122h96l-48-65zm103 8h-111q-1.2 0-2.2-.5-.9-.7-1.5-1.5a4 4 0 0 1 .4-4.1L1167 50l-15-19.8a4 4 0 0 1 .9-5.4 4 4 0 0 1 5.4.7L1172 43l12.8-17.4a4 4 0 0 1 5.5-.9q1.3 1 1.5 2.6.3 1.5-.7 2.9L1176 50l54.5 73.9a4 4 0 0 1-1 5.6c-.6.3-1.8.5-2.5.5"
/>
<text
class="location"
font-family="Jost"
font-weight="700"
letter-spacing="0.2em"
text-anchor="middle"
x="1175"
y="175"
font-size="32"
/>
<text
class="year"
font-family="Jost"
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ cover
.setBackground(BACKGROUND)
.addStripes(STRIPE_COLORS)
.setYear(new Date().getUTCFullYear())
.setLocation("Пермь")
.setTitle({ text: settings.title, color: TEXT_COLOR, fontSize: 80 });
16 changes: 16 additions & 0 deletions src/svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class SvgBuilder {
private readonly title: SVGTextElement;
private readonly stripes: SVGElement;
private readonly year: [SVGTextElement, SVGTextElement];
private readonly location: SVGTextElement;

constructor(private readonly element: SVGElement) {
const background =
Expand Down Expand Up @@ -66,6 +67,15 @@ export class SvgBuilder {
}

this.year = [left, right];

const location =
this.element.querySelector<SVGTextElement>(".location");

if (!location) {
throw new Error("Cannot find title element");
}

this.location = location;
}

setBackground(color: string) {
Expand Down Expand Up @@ -114,6 +124,12 @@ export class SvgBuilder {
return this;
}

setLocation(text: string) {
this.location.textContent = text;

return this;
}

addStripes(colors: string[]) {
this.fillStripeSection(marginBottom, marginBottom + 100, colors);

Expand Down

0 comments on commit ce20b08

Please sign in to comment.