-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Table and ProductLink design changes (#418)
* Table improvements * Revert some changes * Style tweaks * Helper and utility tests * Add alpha color * Update product-badge.scss
- Loading branch information
Showing
35 changed files
with
446 additions
and
254 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{{#if @docs}} | ||
<table class="hds-table"> | ||
<thead> | ||
<tr> | ||
<th class="name">Name</th> | ||
<th class="type">Type</th> | ||
<th class="status">Status</th> | ||
<th class="product">Product/Area</th> | ||
<th class="owner">Owner</th> | ||
<th class="time"> | ||
<Table::SortableHeader | ||
@changeSort={{@changeSort}} | ||
@currentSort={{@currentSort}} | ||
@sortDirection={{@sortDirection}} | ||
@queryParam={{hash | ||
sortBy=(if (eq @sortDirection "desc") "dateAsc" "dateDesc") | ||
page=1 | ||
}} | ||
@attribute="createdTime" | ||
@defaultSortDirection="desc" | ||
> | ||
Created | ||
</Table::SortableHeader> | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{#each @docs as |doc|}} | ||
<Table::Row @doc={{doc}} /> | ||
{{/each}} | ||
</tbody> | ||
</table> | ||
{{#if this.paginationIsShown}} | ||
<Pagination @nbPages={{@nbPages}} @currentPage={{@currentPage}} /> | ||
{{/if}} | ||
{{else}} | ||
{{#if @isDraft}} | ||
<Hds::Alert @type="inline" as |A|> | ||
<A.Title>No drafts found</A.Title> | ||
<A.Button | ||
@text="Create a document draft" | ||
@color="primary" | ||
@icon="file-plus" | ||
@route="authenticated.new" | ||
/> | ||
</Hds::Alert> | ||
{{/if}} | ||
{{/if}} |
15 changes: 9 additions & 6 deletions
15
web/app/components/row-results.ts → web/app/components/documents/table.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,29 @@ | ||
import Component from "@glimmer/component"; | ||
import { HermesDocument } from "hermes/types/document"; | ||
import { SortAttribute, SortDirection } from "./table/sortable-header"; | ||
import { | ||
SortAttribute, | ||
SortDirection, | ||
} from "hermes/components/table/sortable-header"; | ||
|
||
interface RowResultsComponentSignature { | ||
interface DocumentsTableComponentSignature { | ||
Args: { | ||
docs: HermesDocument[]; | ||
isDraft?: boolean; | ||
nbPages: number; | ||
currentPage: number; | ||
nbPages?: number; | ||
currentPage?: number; | ||
changeSort?: (attribute: SortAttribute) => void; | ||
currentSort: `${SortAttribute}`; | ||
sortDirection: SortDirection; | ||
}; | ||
} | ||
export default class RowResultsComponent extends Component<RowResultsComponentSignature> { | ||
export default class DocumentsTableComponent extends Component<DocumentsTableComponentSignature> { | ||
protected get paginationIsShown() { | ||
return this.args.nbPages && this.args.currentPage !== undefined; | ||
} | ||
} | ||
|
||
declare module "@glint/environment-ember-loose/registry" { | ||
export default interface Registry { | ||
RowResults: typeof RowResultsComponent; | ||
"Documents::Table": typeof DocumentsTableComponent; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<LinkTo | ||
@route={{this.route}} | ||
@query={{this.query}} | ||
class="product-link" | ||
...attributes | ||
> | ||
{{#if (has-block "default")}} | ||
{{yield}} | ||
{{else}} | ||
<Hds::Badge | ||
@icon={{or (get-product-id @product) "folder"}} | ||
@text={{this.productAreaName}} | ||
title={{this.productAreaName}} | ||
/> | ||
{{/if}} | ||
</LinkTo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<tr> | ||
<td class="name"> | ||
<LinkTo | ||
@route="authenticated.document" | ||
@model="{{@doc.objectID}}" | ||
@query={{hash draft=(eq @doc.status "wip")}} | ||
class="inner flex h-full w-full items-start gap-3.5 focus:outline-none" | ||
> | ||
<Doc::Thumbnail @product={{@doc.product}} @status={{@doc.status}} /> | ||
<div class="relative overflow-hidden"> | ||
<div> | ||
<h4 | ||
class="hds-typography-body-200 hds-font-weight-semibold hds-foreground-strong" | ||
> | ||
{{@doc.title}} | ||
</h4> | ||
{{#if @doc.docNumber}} | ||
<div class="whitespace-nowrap text-color-foreground-faint"> | ||
{{@doc.docNumber}} | ||
</div> | ||
{{/if}} | ||
</div> | ||
</div> | ||
</LinkTo> | ||
</td> | ||
<td class="type"> | ||
<div class="inner"> | ||
{{@doc.docType}} | ||
</div> | ||
</td> | ||
<td class="status"> | ||
<div class="inner"> | ||
<Doc::State @state={{@doc.status}} @hideProgress={{true}} /> | ||
</div> | ||
</td> | ||
<td class="product"> | ||
<div class="inner"> | ||
<ProductLink | ||
@product={{@doc.product}} | ||
class="decoration-color-palette-neutral-300 underline-offset-[3px] hover:underline" | ||
> | ||
{{get-product-label @doc.product}} | ||
</ProductLink> | ||
</div> | ||
</td> | ||
<td class="owner"> | ||
<div class="inner"> | ||
<Person | ||
@imgURL={{get @doc.ownerPhotos 0}} | ||
@email="{{get @doc.owners 0}}" | ||
/> | ||
</div> | ||
</td> | ||
<td class="time"> | ||
<div class="inner"> | ||
<div | ||
class={{if (eq this.time "Unknown") "text-color-foreground-disabled"}} | ||
> | ||
{{this.time}} | ||
</div> | ||
</div> | ||
</td> | ||
</tr> |
Oops, something went wrong.