UX: Add AdminConfigAreaEmptyList component (#29816)

This component can be used as a placeholder on
admin pages where the table has no data as per
the admin UI guidelines.
This commit is contained in:
Martin Brennan 2024-11-19 16:49:57 +10:00 committed by GitHub
parent 582de0ffe3
commit 01a160d8af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 41 additions and 15 deletions

View File

@ -0,0 +1,20 @@
import DButton from "discourse/components/d-button";
import concatClass from "discourse/helpers/concat-class";
import i18n from "discourse-common/helpers/i18n";
const AdminConfigAreaEmptyList = <template>
<div class="admin-config-area-empty-list">
{{i18n @emptyLabel}}
<DButton
@label={{@ctaLabel}}
class={{concatClass
"btn-default btn-small admin-config-area-empty-list__cta-button"
@ctaClass
}}
@action={{@ctaAction}}
@route={{@ctaRoute}}
/>
</div>
</template>;
export default AdminConfigAreaEmptyList;

View File

@ -16,7 +16,6 @@
@title="admin.permalink.add" @title="admin.permalink.add"
@label="admin.permalink.add" @label="admin.permalink.add"
@icon="plus" @icon="plus"
@disabled={{this.addFlagButtonDisabled}}
class="admin-permalinks__header-add-permalink" class="admin-permalinks__header-add-permalink"
/> />
</:actions> </:actions>
@ -124,9 +123,12 @@
"search.no_results" "search.no_results"
}}</p> }}</p>
{{else}} {{else}}
<p class="permalink-results__no-permalinks">{{i18n <AdminConfigAreaEmptyList
"admin.permalink.no_permalinks" @ctaLabel="admin.permalink.add"
}}</p> @ctaRoute="adminPermalinks.new"
@ctaClass="admin-permalinks__add-permalink"
@emptyLabel="admin.permalink.no_permalinks"
/>
{{/if}} {{/if}}
{{/if}} {{/if}}
</div> </div>

View File

@ -97,9 +97,14 @@
margin-left: 18px; margin-left: 18px;
} }
} }
}
&__empty-list { .admin-config-area-empty-list {
padding: 1em; padding: 1em;
border: 1px solid var(--primary-low); border: 1px solid var(--primary-low);
&__cta-button {
display: flex;
margin-top: 1em;
} }
} }

View File

@ -65,6 +65,12 @@
} }
} }
.admin-customize.admin-permalinks {
.admin-container {
padding: 0;
}
}
.admin-customize { .admin-customize {
h1 { h1 {
margin-bottom: 10px; margin-bottom: 10px;

View File

@ -123,10 +123,3 @@
width: 100%; width: 100%;
} }
} }
.admin-plugin-config-area {
&__empty-list {
padding: 1em;
border: 1px solid var(--primary-low);
}
}

View File

@ -7281,7 +7281,7 @@ en:
destination: "Destination" destination: "Destination"
copy_to_clipboard: "Copy Permalink to Clipboard" copy_to_clipboard: "Copy Permalink to Clipboard"
delete_confirm: Are you sure you want to delete this permalink? delete_confirm: Are you sure you want to delete this permalink?
no_permalinks: "You don't have any permalinks yet. Create a new permalink above to begin seeing a list of your permalinks here." no_permalinks: "You don't have any permalinks yet."
add: "Add permalink" add: "Add permalink"
back: "Back to Permalinks" back: "Back to Permalinks"
more_options: "More options" more_options: "More options"