From 536590d8cf3e7f0d403785596d458a9f3ea2530d Mon Sep 17 00:00:00 2001 From: Shane Melton Date: Fri, 28 Oct 2022 10:38:27 -0700 Subject: [PATCH] [EC-593] Top align event logs row content (#3813) * [EC-593] Top align event log row contents * [EC-593] Prevent event log timestamp from wrapping * [EC-593] Add alignContent input to bitRow directive * [EC-593] Remove ineffective inline styles (CSP) * [EC-593] Remove templated tailwind classes Tailwind minimizes the bundled stylesheet by removing classes that aren't used in code. Using a string template for the classes causes those classes to be ignored. * [EC-593] Introduce alignContent input to table story --- .../manage/events.component.html | 10 +++++----- libs/components/src/table/row.directive.ts | 18 +++++++++++++++++- libs/components/src/table/table.stories.ts | 19 ++++++++++++++----- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/apps/web/src/app/organizations/manage/events.component.html b/apps/web/src/app/organizations/manage/events.component.html index ed7ddfad595..a7468bcf378 100644 --- a/apps/web/src/app/organizations/manage/events.component.html +++ b/apps/web/src/app/organizations/manage/events.component.html @@ -69,15 +69,15 @@ - {{ "timestamp" | i18n }} - {{ "client" | i18n }} - {{ "member" | i18n }} + {{ "timestamp" | i18n }} + {{ "client" | i18n }} + {{ "member" | i18n }} {{ "event" | i18n }} - - {{ e.date | date: "medium" }} + + {{ e.date | date: "medium" }} {{ e.appName }} diff --git a/libs/components/src/table/row.directive.ts b/libs/components/src/table/row.directive.ts index ebef2f520a1..5d9eaca2613 100644 --- a/libs/components/src/table/row.directive.ts +++ b/libs/components/src/table/row.directive.ts @@ -1,9 +1,24 @@ -import { HostBinding, Directive } from "@angular/core"; +import { Directive, HostBinding, Input } from "@angular/core"; @Directive({ selector: "tr[bitRow]", }) export class RowDirective { + @Input() alignContent: "top" | "middle" | "bottom" | "baseline" = "baseline"; + + get alignmentClass(): string { + switch (this.alignContent) { + case "top": + return "tw-align-top"; + case "middle": + return "tw-align-middle"; + case "bottom": + return "tw-align-bottom"; + default: + return "tw-align-baseline"; + } + } + @HostBinding("class") get classList() { return [ "tw-border-0", @@ -12,6 +27,7 @@ export class RowDirective { "tw-border-solid", "hover:tw-bg-background-alt", "last:tw-border-0", + this.alignmentClass, ]; } } diff --git a/libs/components/src/table/table.stories.ts b/libs/components/src/table/table.stories.ts index 49da9cd0160..961636dd9cc 100644 --- a/libs/components/src/table/table.stories.ts +++ b/libs/components/src/table/table.stories.ts @@ -9,6 +9,12 @@ export default { imports: [TableModule], }), ], + argTypes: { + alignRowContent: { + options: ["top", "middle", "bottom", "baseline"], + control: { type: "select" }, + }, + }, parameters: { design: { type: "figma", @@ -29,18 +35,18 @@ const Template: Story = (args) => ({ - + Cell 1 - Cell 2 + Cell 2
Multiline Cell Cell 3 - + Cell 4 Cell 5 Cell 6 - - Cell 7 + + Cell 7
Multiline Cell Cell 8 Cell 9 @@ -51,3 +57,6 @@ const Template: Story = (args) => ({ }); export const Default = Template.bind({}); +Default.args = { + alignRowContent: "baseline", +};