Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add medium size to DocThumbnail; tweak shared types #388

Merged
merged 30 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4c93e39
Tweak HDS types
jeffdaley Oct 26, 2023
eb2a9e0
Updates `get-product-id` files
jeffdaley Oct 26, 2023
e1d0c47
Add `medium` size to DocThumbnail
jeffdaley Oct 26, 2023
08ae24d
Remove number type
jeffdaley Oct 27, 2023
a9f5054
Merge branch 'main' into jeffdaley/get-product-id
jeffdaley Oct 27, 2023
a2068e0
Update `productShortName` getter
jeffdaley Oct 27, 2023
9c69119
Merge branch 'main' into jeffdaley/medium-thumbnail
jeffdaley Oct 27, 2023
58980e1
Avatar.gts
jeffdaley Oct 27, 2023
8c4360b
Merge branch 'jeffdaley/glint-types' into jeffdaley/product-avatar-2
jeffdaley Oct 27, 2023
048bcc7
Merge branch 'jeffdaley/get-product-id' into jeffdaley/product-avatar-2
jeffdaley Oct 27, 2023
5fcf37a
Basic ProductAvatar implementation
jeffdaley Oct 27, 2023
8ffe69f
Merge branch 'main' into jeffdaley/product-avatar-2
jeffdaley Oct 27, 2023
7664960
Merge branch 'main' into jeffdaley/medium-thumbnail
jeffdaley Oct 27, 2023
db17ae7
Add `large` size to PersonAvatar
jeffdaley Oct 27, 2023
33558e8
Refactor to class-based sizing
jeffdaley Oct 27, 2023
28590d1
Fix visual bugs, rename SCSS file
jeffdaley Oct 30, 2023
1df9ef0
Refactor Thumbnail interface
jeffdaley Oct 30, 2023
6ec08e4
Switch `size` to getters
jeffdaley Oct 30, 2023
f814361
Merge branch 'jeffdaley/product-avatar-2' into jeffdaley/large-avatar
jeffdaley Oct 30, 2023
54f0fc9
Merge branch 'jeffdaley/large-avatar' into jeffdaley/medium-thumbnail
jeffdaley Oct 30, 2023
8ead6bc
Remove unused getters
jeffdaley Oct 30, 2023
9175628
Merge branch 'main' into jeffdaley/medium-thumbnail
jeffdaley Nov 6, 2023
682c93a
Fix merge conflict
jeffdaley Nov 6, 2023
07e51a9
Merge branch 'main' into jeffdaley/medium-thumbnail
jeffdaley Nov 8, 2023
1d09486
Update thumbnail.ts
jeffdaley Nov 9, 2023
61cb8a9
Remove unnecessary property
jeffdaley Nov 9, 2023
6ca7b85
Refactor sizes
jeffdaley Nov 9, 2023
0abc6d0
Use enum in folder-affordance
jeffdaley Nov 9, 2023
10b4686
Revert css changes
jeffdaley Nov 9, 2023
50bb435
Additional cleanup
jeffdaley Nov 9, 2023
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
12 changes: 6 additions & 6 deletions web/app/components/doc/folder-affordance.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
data-test-doc-thumbnail-folder-affordance
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox={{if this.sizeIsLarge "0 0 97 145" "0 0 43 63"}}
viewBox={{if this.sizeIsSmall "0 0 43 63" "0 0 97 145"}}
class="folder-affordance"
>
<path
fill="url(#doc-thumbnail-folder-gradient)"
stroke="currentColor"
fill-rule="evenodd"
d={{if
this.sizeIsLarge
"M6 0a6 6 0 0 0-6 6v41.04a6 6 0 0 0 2.659 4.983l8.29 5.558v80.729a6 6 0 0 0 6 6H97V0H6Z"
this.sizeIsSmall
"M3 0a3 3 0 0 0-3 3v18.407a3 3 0 0 0 .91 2.152l2.18 2.117v33.746a3 3 0 0 0 3 3H43V0H3Z"
"M6 0a6 6 0 0 0-6 6v41.04a6 6 0 0 0 2.659 4.983l8.29 5.558v80.729a6 6 0 0 0 6 6H97V0H6Z"
}}
clip-rule="evenodd"
></path>
<defs>
<linearGradient
id="doc-thumbnail-folder-gradient"
x1={{if this.sizeIsLarge "8.176" "4.746"}}
x2={{if this.sizeIsLarge "8.176" "4.746"}}
x1={{if this.sizeIsSmall "4.746" "8.176"}}
x2={{if this.sizeIsSmall "4.746" "8.176"}}
y1="0"
y2={{if this.sizeIsLarge "43.965" "19.018"}}
y2={{if this.sizeIsSmall "19.018" "43.965"}}
gradientUnits="userSpaceOnUse"
>
<stop stop-color="var(--token-color-palette-neutral-50)"></stop>
Expand Down
8 changes: 5 additions & 3 deletions web/app/components/doc/folder-affordance.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import Component from "@glimmer/component";
import { DocThumbnailSize } from "hermes/components/doc/thumbnail";
import { HermesSize } from "hermes/types/sizes";

interface DocFolderAffordanceSignature {
Args: {
size?: "large";
size?: `${DocThumbnailSize}`;
};
}

export default class DocFolderAffordance extends Component<DocFolderAffordanceSignature> {
protected get sizeIsLarge(): boolean {
return this.args.size === "large";
protected get sizeIsSmall(): boolean {
return this.args.size === HermesSize.Small || !this.args.size;
}
}

Expand Down
10 changes: 4 additions & 6 deletions web/app/components/doc/thumbnail.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import Component from "@glimmer/component";
import { dasherize } from "@ember/string";
import getProductId from "hermes/utils/get-product-id";
import { HermesSize } from "hermes/types/sizes";

export enum DocThumbnailSize {
Small = "small",
Large = "large",
}
export type DocThumbnailSize = Exclude<HermesSize, HermesSize.XL>;

interface DocThumbnailComponentSignature {
Element: HTMLDivElement;
Args: {
status?: string;
product?: string;
size?: "large";
size?: `${DocThumbnailSize}`;
};
}

Expand All @@ -26,7 +24,7 @@ export default class DocThumbnailComponent extends Component<DocThumbnailCompone
}

protected get size() {
return this.args.size ?? DocThumbnailSize.Small;
return this.args.size ?? HermesSize.Small;
}

protected get productShortName(): string | undefined {
Expand Down
9 changes: 3 additions & 6 deletions web/app/components/person/avatar.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
import Component from "@glimmer/component";
import {
HermesBasicAvatarSize,
HermesPersonAvatarSize,
} from "hermes/types/avatar-size";
import { HermesSize } from "hermes/types/sizes";

interface PersonAvatarComponentSignature {
Element: HTMLDivElement;
Args: {
imgURL?: string | null;
isLoading?: boolean;
email: string;
size?: `${HermesPersonAvatarSize}`;
size?: `${HermesSize}`;
};
Blocks: {
default: [];
};
}

export default class PersonAvatarComponent extends Component<PersonAvatarComponentSignature> {
protected size = this.args.size ?? HermesBasicAvatarSize.Small;
protected size = this.args.size ?? HermesSize.Small;
}

declare module "@glint/environment-ember-loose/registry" {
Expand Down
6 changes: 3 additions & 3 deletions web/app/components/product/avatar.gts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { inject as service } from "@ember/service";
import FlightIcon from "@hashicorp/ember-flight-icons/components/flight-icon";
import ProductAreasService from "hermes/services/product-areas";
import { assert } from "@ember/debug";
import { HermesBasicAvatarSize } from "hermes/types/avatar-size";
import { HermesSize } from "hermes/types/sizes";

interface ProductAvatarComponentSignature {
Element: HTMLDivElement;
Args: {
product?: string;
size?: `${HermesBasicAvatarSize}`;
size?: `${Exclude<HermesSize, HermesSize.XL>}`;
};
Blocks: {
default: [];
Expand All @@ -27,7 +27,7 @@ export default class ProductAvatarComponent extends Component<ProductAvatarCompo
}

private get size() {
return this.args.size ?? HermesBasicAvatarSize.Small;
return this.args.size ?? HermesSize.Small;
}

<template>
Expand Down
16 changes: 16 additions & 0 deletions web/app/styles/components/doc/thumbnail.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@
}
}

&.medium {
@apply w-16;

.status-icon {
@apply top-[6px] h-[60px] w-[60px];

&.approved {
@apply -right-2.5;
}

&.obsolete {
@apply -left-3.5;
}
}
}

&.large {
@apply w-28;

Expand Down
13 changes: 0 additions & 13 deletions web/app/types/avatar-size.ts

This file was deleted.

6 changes: 6 additions & 0 deletions web/app/types/sizes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export enum HermesSize {
Small = "small",
Medium = "medium",
Large = "large",
XL = "xl",
}