From d975afb507ae269f5989f8f5551d8e56e4d76183 Mon Sep 17 00:00:00 2001 From: Kai Arrowood Date: Fri, 15 Sep 2023 09:29:22 -0400 Subject: [PATCH] feat(about-section): new component [khcp-8589] (#782) * feat(about-section): new component [khcp-8589] * fix(*): lint * fix(*): alignment * fix(*): pr feedback * fix(*): pr feedback Co-authored-by: Adam DeHaven <2229946+adamdehaven@users.noreply.github.com> * fix(*): pr feedback * fix(*): lint * fix(kcard): styles * fix(*): lint * fix(*): add docs * fix(*): loading state * fix(*): text * test(about-section): add component test * fix(*): test ext * fix(*): tests * fix(*): tests * fix(*): pr feedback --------- Co-authored-by: Adam DeHaven <2229946+adamdehaven@users.noreply.github.com> --- .../analytics-chart/docs/top-n-table.md | 8 + .../analytics/analytics-chart/sandbox/App.vue | 8 + .../src/components/TopNTable.vue | 42 ++- .../core/app-layout/docs/about-section.md | 102 ++++++++ .../sandbox/pages/PageHeaderPage.vue | 98 ++++++- .../aboutSection/AppAboutSection.cy.ts | 116 +++++++++ .../aboutSection/AppAboutSection.vue | 243 ++++++++++++++++++ packages/core/app-layout/src/index.ts | 2 + 8 files changed, 615 insertions(+), 4 deletions(-) create mode 100644 packages/core/app-layout/docs/about-section.md create mode 100644 packages/core/app-layout/src/components/aboutSection/AppAboutSection.cy.ts create mode 100644 packages/core/app-layout/src/components/aboutSection/AppAboutSection.vue diff --git a/packages/analytics/analytics-chart/docs/top-n-table.md b/packages/analytics/analytics-chart/docs/top-n-table.md index b32f6352ba..ef8dad10e6 100644 --- a/packages/analytics/analytics-chart/docs/top-n-table.md +++ b/packages/analytics/analytics-chart/docs/top-n-table.md @@ -54,6 +54,14 @@ Text to be displayed opposite the card title. Text to be displayed on the empty state. +#### `isLoading` + +- type: `Boolean` +- required: `false` +- default: `false` + +Whether or not to display the loading state. + ### Slots #### name diff --git a/packages/analytics/analytics-chart/sandbox/App.vue b/packages/analytics/analytics-chart/sandbox/App.vue index 75d3f7bb31..90ffc98af0 100644 --- a/packages/analytics/analytics-chart/sandbox/App.vue +++ b/packages/analytics/analytics-chart/sandbox/App.vue @@ -182,6 +182,7 @@ class="top-n-sandbox" :data="exploreResultV3" description="Last 30-Day Summary" + :is-loading="showLoadingState" title="Top 5 Routes" > + + { } .column-1 { - padding: 0 $kui-space-80 $kui-space-60 0; + padding: $kui-space-0 $kui-space-80 $kui-space-50 $kui-space-0; } .column-2 { flex: 1; max-width: 110px; - padding: 0 0 $kui-space-60 0; + padding: $kui-space-0 $kui-space-0 $kui-space-50 $kui-space-0; } .table-body { + .table-row:first-of-type { + border-top: $kui-border-width-10 solid $kui-color-border; + } + .column-1, .column-2 { - padding-top: $kui-space-60; + padding-top: $kui-space-50; } .column-1 { @@ -261,3 +275,25 @@ const getValue = (record: AnalyticsExploreRecord): string => { } } + + diff --git a/packages/core/app-layout/docs/about-section.md b/packages/core/app-layout/docs/about-section.md new file mode 100644 index 0000000000..c16a1ef006 --- /dev/null +++ b/packages/core/app-layout/docs/about-section.md @@ -0,0 +1,102 @@ +# AppAboutSection.vue + +A Kong UI dynamic about section component. + +- [Features](#features) +- [Requirements](#requirements) +- [Usage](#usage) + - [Install](#install) + - [Props](#props) + - [Slots](#slots) + +## Features + +- Reactive updates based on `prop` value changes :rocket: +- Slottable areas for displaying custom content + +## Requirements + +- `vue` must be initialized in the host application +- `@kong/kongponents` must be available as a `dependency` in the host application, along with the package's style imports. [See here for instructions on installing Kongponents](https://kongponents.konghq.com/#globally-install-all-kongponents). + +## Usage + +### Install + +[See instructions for installing the `@kong-ui-public/app-layout` package.](../README.md#install) + +### Props + +#### `title` + +- type: `String` +- required: `false` +- default: `''` + +The title text of the about section. + +#### `description` + +- type: `String` +- required: `false` +- default: `''` + +Descriptive text displayed below the `title` + +#### `created` + +- type: `String` +- required: `false` +- default: `''` + +Created timestamp displayed to the left of the `actions` slot. + +#### `createdLabel` + +- type: `String` +- required: `false` +- default: `''` + +Label text for the `created` timestamp, defaults to `Created`. + +#### `modified` + +- type: `String` +- required: `false` +- default: `''` + +Modified timestamp displayed to the left of the `actions` slot. + +#### `modifiedLabel` + +- type: `String` +- required: `false` +- default: `''` + +Label text for the `modified` timestamp, defaults to `Modified`. + +#### `isLoading` + +- type: `Boolean` +- required: `false` +- default: `false` + +Display the loading state or not. + +### Slots + +#### `actions` + +Content displayed opposite the title. + +#### `default` + +Main content to be displayed in the section + +#### `divider-section` + +Additional content displayed below the main content, separated with a horizontal divider. + +--- + +[← Back to `@kong-ui-public/app-layout` docs](../README.md) diff --git a/packages/core/app-layout/sandbox/pages/PageHeaderPage.vue b/packages/core/app-layout/sandbox/pages/PageHeaderPage.vue index 3886f9e3d6..5e17280613 100644 --- a/packages/core/app-layout/sandbox/pages/PageHeaderPage.vue +++ b/packages/core/app-layout/sandbox/pages/PageHeaderPage.vue @@ -52,12 +52,89 @@ + + + + +
+ Name: + + TK + +
+
+ Color: + + BLACK + +
+
+ Type: + + COOL + +
+
+ Methods: + +
+ + +
+ + + + diff --git a/packages/core/app-layout/src/index.ts b/packages/core/app-layout/src/index.ts index 706c55351b..c5ac8f607e 100644 --- a/packages/core/app-layout/src/index.ts +++ b/packages/core/app-layout/src/index.ts @@ -1,6 +1,7 @@ import type { App } from 'vue' import AccountDropdown from './components/navbar/AccountDropdown.vue' +import AppAboutSection from './components/aboutSection/AppAboutSection.vue' import AppError from './components/errors/AppError.vue' import AppLayout from './components/AppLayout.vue' import AppNavbar from './components/navbar/AppNavbar.vue' @@ -20,6 +21,7 @@ export default { // Export individual Components export { AccountDropdown, + AppAboutSection, AppError, AppLayout, AppNavbar,