Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

Each version's section is written by the pull request that changes the version, from the pull requests merged since the previous version, as the [README](README.md#releases) says; other pull requests don't edit this file.

## 0.0.41

- `@noldova/ui.components.angular`: a `SiteLink` takes `isIconOnly`, false by default. A footer link with an icon and `isIconOnly` draws its icon alone, in a pointer target from the group's edge, named and tooltipped by its label, such as X beside its mark (#210).

## 0.0.40

- `@noldova/ui.components.angular`: the site header takes `translucent`, true by default. False keeps the header in the window's color while the page scrolls under it, in place of 92% of it over a blur, for a documentation site whose readers read long text under it; the docs site turns it off (#208).
Expand Down
1 change: 1 addition & 0 deletions documents/kit/site-footer.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ At the start, the lockup, with the site's `wordmarkSize`, then an optional line
At the end, the link groups, 3rem apart (`--nol-site-footer-group-gap`), the last one ending at the content's end; when the footer is too narrow for both, the groups wrap under the lockup, 2rem from it (`--nol-site-footer-gap`).
Each group's title is 0.5rem above its links, and the links are 0.625rem apart (`--nol-site-footer-link-gap`); each is at least the pointer target high and wide, so a one-letter link such as X is a whole target.
A link the site gives an `icon` draws it first, as a mask as high as its text, 0.5rem from its label, in `--nol-brand-mark` as the header's social marks are.
A link with an icon and `isIconOnly` draws the icon alone, from the group's edge in a pointer target, its label naming it for assistive technology and as its tooltip, such as X beside its mark; without an icon, a link always draws its label.
When the footer is at most 47.5rem wide, as on a phone, the content takes the phone insets, 2.75rem from the top (`--nol-site-footer-padding-block-phone`), and the groups are 2.5rem apart (`--nol-site-footer-group-gap-phone`). The theme still defines `--nol-site-footer-gap-phone` (1.5rem), the phone gap of the footer's former layout, but nothing in the kit reads it now.

## Text roles
Expand Down
11 changes: 10 additions & 1 deletion src/noldova.ui.components.angular/src/api/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12310,15 +12310,24 @@ export declare class SiteLink {
*/
public readonly icon: string | null;

/**
* Whether a footer link with an icon draws the icon alone, its label then
* naming the link for assistive technology and as its tooltip, such as X
* beside its mark; false, the default, draws the label after the icon.
* A link with no icon always draws its label.
*/
public readonly isIconOnly: boolean;

/**
* Creates the link.
*
* @param label The text it shows.
* @param href Where it leads.
* @param isCurrent Whether it leads to the current page; false when left out.
* @param icon The address of an SVG drawn before the label; none when left out.
* @param isIconOnly Whether a footer link draws its icon alone; false when left out.
*/
public constructor(label: string, href: string, isCurrent?: boolean, icon?: string | null);
public constructor(label: string, href: string, isCurrent?: boolean, icon?: string | null, isIconOnly?: boolean);
}

/**
Expand Down
11 changes: 10 additions & 1 deletion src/noldova.ui.components.angular/src/api/site-footer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,24 @@ export declare class SiteLink {
*/
public readonly icon: string | null;

/**
* Whether a footer link with an icon draws the icon alone, its label then
* naming the link for assistive technology and as its tooltip, such as X
* beside its mark; false, the default, draws the label after the icon.
* A link with no icon always draws its label.
*/
public readonly isIconOnly: boolean;

/**
* Creates the link.
*
* @param label The text it shows.
* @param href Where it leads.
* @param isCurrent Whether it leads to the current page; false when left out.
* @param icon The address of an SVG drawn before the label; none when left out.
* @param isIconOnly Whether a footer link draws its icon alone; false when left out.
*/
public constructor(label: string, href: string, isCurrent?: boolean, icon?: string | null);
public constructor(label: string, href: string, isCurrent?: boolean, icon?: string | null, isIconOnly?: boolean);
}

/**
Expand Down
11 changes: 10 additions & 1 deletion src/noldova.ui.components.angular/src/api/site-header.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,24 @@ export declare class SiteLink {
*/
public readonly icon: string | null;

/**
* Whether a footer link with an icon draws the icon alone, its label then
* naming the link for assistive technology and as its tooltip, such as X
* beside its mark; false, the default, draws the label after the icon.
* A link with no icon always draws its label.
*/
public readonly isIconOnly: boolean;

/**
* Creates the link.
*
* @param label The text it shows.
* @param href Where it leads.
* @param isCurrent Whether it leads to the current page; false when left out.
* @param icon The address of an SVG drawn before the label; none when left out.
* @param isIconOnly Whether a footer link draws its icon alone; false when left out.
*/
public constructor(label: string, href: string, isCurrent?: boolean, icon?: string | null);
public constructor(label: string, href: string, isCurrent?: boolean, icon?: string | null, isIconOnly?: boolean);
}

/**
Expand Down
11 changes: 10 additions & 1 deletion src/noldova.ui.components.angular/src/api/site.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -571,15 +571,24 @@ export declare class SiteLink {
*/
public readonly icon: string | null;

/**
* Whether a footer link with an icon draws the icon alone, its label then
* naming the link for assistive technology and as its tooltip, such as X
* beside its mark; false, the default, draws the label after the icon.
* A link with no icon always draws its label.
*/
public readonly isIconOnly: boolean;

/**
* Creates the link.
*
* @param label The text it shows.
* @param href Where it leads.
* @param isCurrent Whether it leads to the current page; false when left out.
* @param icon The address of an SVG drawn before the label; none when left out.
* @param isIconOnly Whether a footer link draws its icon alone; false when left out.
*/
public constructor(label: string, href: string, isCurrent?: boolean, icon?: string | null);
public constructor(label: string, href: string, isCurrent?: boolean, icon?: string | null, isIconOnly?: boolean);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
<p class="nol-site-footer-title" aria-hidden="true">{{ group.title }}</p>
<ul class="nol-site-footer-links">
@for (link of group.links; track link.href) {
<li class="nol-site-footer-item"><a class="nol-site-footer-link" [href]="link.href" [attr.aria-current]="link.isCurrent ? partResources.currentPage : null"
<li class="nol-site-footer-item">@if (link.isIconOnly && link.icon; as icon) {<a class="nol-site-footer-link" [href]="link.href" [attr.aria-current]="link.isCurrent ? partResources.currentPage : null"
Comment thread
rostislavrotaru marked this conversation as resolved.
Resolved
[attr.aria-label]="link.label" [title]="link.label"><span class="nol-site-footer-link-icon" aria-hidden="true" [style.mask-image]="maskOf(icon)"></span></a
>} @else {<a class="nol-site-footer-link" [href]="link.href" [attr.aria-current]="link.isCurrent ? partResources.currentPage : null"
>@if (link.icon; as icon) {<span class="nol-site-footer-link-icon" aria-hidden="true" [style.mask-image]="maskOf(icon)"></span>}{{ link.label }}</a
></li>
>}</li>
}
</ul>
</nav>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ export class SiteLink {
public readonly href: string;
public readonly isCurrent: boolean;
public readonly icon: string | null;
public readonly isIconOnly: boolean;

public constructor(label: string, href: string, isCurrent: boolean = false, icon: string | null = null) {
public constructor(label: string, href: string, isCurrent: boolean = false, icon: string | null = null, isIconOnly: boolean = false) {
this.label = label;
this.href = href;
this.isCurrent = isCurrent;
this.icon = icon;
this.isIconOnly = isIconOnly;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class SiteStageService {
}

public link(link: SiteLink): SiteLink {
return new SiteLink(link.label, this.address(link.href), link.isCurrent, link.icon);
return new SiteLink(link.label, this.address(link.href), link.isCurrent, link.icon, link.isIconOnly);
}

private static stageOf(hostname: string): SiteStage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,24 @@ describe("SiteFooterComponent", () => {
expect(DomFixture.maybe(DomFixture.present(privacy), ".nol-site-footer-link-icon")).toBeNull();
});

it("draws an icon-only link's icon alone, named and tooltipped by its label, a pointer target from the group's edge, and a label for an icon-only link with no icon", async () => {
await renderAsync(t => t.groups.set([new SiteLinkGroup("Connect", [new SiteLink("GitHub", "#github", false, mark), new SiteLink("X", "#x", false, mark, true), new SiteLink("Privacy", "#privacy", false, null, true)])]));
const links = all(".nol-site-footer-link");
const [github, x, privacy] = [DomFixture.present(links[0]), DomFixture.present(links[1]), DomFixture.present(links[2])];
const icon = DomFixture.one(x, ".nol-site-footer-link-icon").getBoundingClientRect();
const link = x.getBoundingClientRect();
const target = AppearanceFixture.measureLook("pointer-target");

expect([x.textContent?.trim(), x.getAttribute("aria-label"), x.getAttribute("title"), x.children.length]).toEqual(["", "X", "X", 1]);
expect([github.textContent?.trim(), github.getAttribute("aria-label"), privacy.textContent?.trim(), privacy.getAttribute("aria-label")]).toEqual(["GitHub", null, "Privacy", null]);
AppearanceFixture.expectPixels(icon.width, Number.parseFloat(getComputedStyle(x).fontSize));
AppearanceFixture.expectPixels(link.width, target);
AppearanceFixture.expectPixels(link.height, target);
AppearanceFixture.expectPixels(link.left, github.getBoundingClientRect().left);
AppearanceFixture.expectPixels(icon.left, link.left);
AppearanceFixture.expectPixels(icon.top + icon.height / 2, link.top + link.height / 2);
});

it("underlines a hovered link in the strong text color, and outlines a focused one in the accent color", async () => {
await renderAsync();
const [hovered, focused] = all(".nol-site-footer-link");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ describe("SiteStageService", () => {
expect(kept.map(t => service.address(t))).toEqual(kept);
});

it("gives a link at the page's stage, keeping its label, current mark and icon", () => {
const link = serviceAt("teamrun.staging.noldova.com").link(new SiteLink("Docs", "https://teamrun.noldova.dev/start", true, "/docs.svg"));
it("gives a link at the page's stage, keeping its label, current mark, icon and icon-only mark", () => {
const link = serviceAt("teamrun.staging.noldova.com").link(new SiteLink("Docs", "https://teamrun.noldova.dev/start", true, "/docs.svg", true));

expect([link.label, link.href, link.isCurrent, link.icon]).toEqual(["Docs", "https://teamrun.staging.noldova.dev/start", true, "/docs.svg"]);
expect([link.label, link.href, link.isCurrent, link.icon, link.isIconOnly]).toEqual(["Docs", "https://teamrun.staging.noldova.dev/start", true, "/docs.svg", true]);
});
});
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "version": "0.0.40" }
{ "version": "0.0.41" }
Loading