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

EmptyStateText #355

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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: 2 additions & 2 deletions web/app/components/custom-editable-field.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{{F.value}}
</p>
{{else}}
<CustomEditableFields::EmptyState />
<EmptyStateText />
{{/if}}
</:default>
<:editing as |F|>
Expand Down Expand Up @@ -48,7 +48,7 @@
{{/each}}
</ol>
{{else}}
<CustomEditableFields::EmptyState />
<EmptyStateText />
{{/if}}
</:default>
<:editing as |F|>
Expand Down
3 changes: 0 additions & 3 deletions web/app/components/custom-editable-fields/empty-state.hbs

This file was deleted.

18 changes: 0 additions & 18 deletions web/app/components/custom-editable-fields/empty-state.ts

This file was deleted.

4 changes: 2 additions & 2 deletions web/app/components/document/sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@
{{/each}}
</ol>
{{else}}
<em>No contributors</em>
<EmptyStateText />
{{/if}}
</:default>
<:editing as |F|>
Expand Down Expand Up @@ -274,7 +274,7 @@
{{/each}}
</ol>
{{else}}
<em>No approvers</em>
<EmptyStateText />
{{/if}}
</:default>
<:editing as |F|>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div {{did-insert this.enableAnimation}}>
{{#if this.listIsEmpty}}
<div class="mt-1.5" data-test-related-resources-list-empty-state>
<CustomEditableFields::EmptyState />
<EmptyStateText />
</div>
{{else}}
<ul class="related-resources-list" ...attributes>
Expand Down
24 changes: 24 additions & 0 deletions web/app/components/empty-state-text.gts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import Component from "@glimmer/component";
import or from "ember-truth-helpers/helpers/or";

interface EmptyStateTextComponentSignature {
Element: HTMLSpanElement;
Args: {
value?: string;
};
Blocks: {};
}

export default class EmptyStateTextComponent extends Component<EmptyStateTextComponentSignature> {
<template>
<span class="empty-state-text text-color-foreground-disabled" ...attributes>
{{or @value "None"}}
</span>
</template>
}

declare module "@glint/environment-ember-loose/registry" {
export default interface Registry {
EmptyStateText: typeof EmptyStateTextComponent;
}
}
6 changes: 3 additions & 3 deletions web/app/components/inputs/product-select/item.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div
data-test-product-select-item
class="relative flex w-full product-select-item"
class="product-select-item relative flex w-full"
...attributes
>
<FlightIcon
Expand All @@ -9,14 +9,14 @@
@name={{or (get-product-id @product) "folder"}}
/>

<span data-test-product-select-item-value class="flex ml-2.5 leading-none">
<span data-test-product-select-item-value class="ml-2.5 flex leading-none">
{{@product}}
</span>

{{#if @abbreviation}}
<span
data-test-product-select-item-abbreviation
class="opacity-50 inline-flex ml-2 text-body-100 leading-none"
class="ml-2 inline-flex text-body-100 leading-none opacity-50"
>
{{@abbreviation}}
</span>
Expand Down
2 changes: 1 addition & 1 deletion web/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
content: ["./app/**/*.{html,js,hbs}"],
content: ["./app/**/*.{html,js,hbs,gts}"],
theme: {
fontSize: {
"display-500": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ module("Integration | Component | custom-editable-field", function (hooks) {
/>
`);

assert.dom("[data-test-custom-string-field]").hasText("---");
assert.dom("[data-test-custom-string-field]").hasText("None");
assert.dom("[data-test-custom-people-field]").doesNotExist();

this.set("attributes", {
type: "PEOPLE",
});

assert.dom("[data-test-custom-people-field]").hasText("---");
assert.dom("[data-test-custom-people-field]").hasText("None");
assert.dom("[data-test-custom-string-field]").doesNotExist();
});

Expand Down
18 changes: 18 additions & 0 deletions web/tests/integration/components/empty-state-text-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { render } from "@ember/test-helpers";
import { hbs } from "ember-cli-htmlbars";
import { setupRenderingTest } from "ember-qunit";
import { module, test } from "qunit";

module("Integration | Component | empty-state-text", function (hooks) {
setupRenderingTest(hooks);

test("it renders as expected", async function (assert) {
await render(hbs`
<EmptyStateText data-test-one />
<EmptyStateText data-test-two @value="foo" />
`);

assert.dom("[data-test-one]").hasText("None");
assert.dom("[data-test-two]").hasText("foo");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ module(
this.set("product", "Vault");
this.set("isSelected", false);

await render(hbs`
{{! @glint-nocheck: not typesafe yet }}
await render<InputsProductSelectItemContext>(hbs`
<Inputs::ProductSelect::Item
@product={{this.product}}
@isSelected={{this.isSelected}}
Expand All @@ -35,7 +34,7 @@ module(
.hasAttribute(
"data-test-icon",
"vault",
"the correct product icon is shown"
"the correct product icon is shown",
);

assert
Expand All @@ -58,8 +57,8 @@ module(
.hasAttribute(
"data-test-icon",
"folder",
"the correct product icon is shown"
"the correct product icon is shown",
);
});
}
},
);