From 9230af797644a0b924d67a9ec745d5f7b0137308 Mon Sep 17 00:00:00 2001 From: Jeremy <15975785+jw-foss@users.noreply.github.com> Date: Sat, 20 Aug 2022 21:41:49 +0800 Subject: [PATCH] feat(components): [page-header] enhancement (#9215) * feat(components): [page-header] enhancement * Add new slot `extra` for page header. * Add addtional documentations for page header. * chore: update doc * feat: add default slot * chore: add a11y support for back button * chore: update examples * chore: enhancements * chore: example enhancement * chore: restore previous actions for back button * chore: address PR comments Co-authored-by: JeremyWuuuuu <15975785+JeremyWuuuuu@users.noreply.github.com> --- docs/en-US/component/page-header.md | 88 +++++++++++++++++-- .../page-header/additional-sections.vue | 24 +++++ docs/examples/page-header/basic.vue | 6 +- docs/examples/page-header/breadcrumb.vue | 18 ++++ docs/examples/page-header/complete.vue | 69 +++++++++++++++ docs/examples/page-header/custom-icon.vue | 6 +- docs/examples/page-header/main-content.vue | 11 +++ docs/examples/page-header/no-icon.vue | 7 ++ .../__tests__/page-header.test.tsx | 56 ++++++++++-- .../page-header/src/page-header.vue | 63 ++++++++++--- packages/theme-chalk/src/page-header.scss | 68 ++++++++------ 11 files changed, 361 insertions(+), 55 deletions(-) create mode 100644 docs/examples/page-header/additional-sections.vue create mode 100644 docs/examples/page-header/breadcrumb.vue create mode 100644 docs/examples/page-header/complete.vue create mode 100644 docs/examples/page-header/main-content.vue create mode 100644 docs/examples/page-header/no-icon.vue diff --git a/docs/en-US/component/page-header.md b/docs/en-US/component/page-header.md index 2f4f8103a2..9220d41d2a 100644 --- a/docs/en-US/component/page-header.md +++ b/docs/en-US/component/page-header.md @@ -7,8 +7,18 @@ lang: en-US If path of the page is simple, it is recommended to use PageHeader instead of the Breadcrumb. +## Complete example + +:::demo + +page-header/complete + +::: + ## Basic usage +Standard page header, for simply scenarios. + :::demo page-header/basic @@ -17,12 +27,77 @@ page-header/basic ## Custom icon +The default icon might not meet your satisfaction, you can customize the icon by setting `icon` attribute +like the example. + :::demo page-header/custom-icon ::: +## No icon + +Sometimes the page is just full of elements, and you might not want the icon to show up on the page, +you can set the `icon` attribute to `null` to get rid of it. + +:::demo + +page-header/no-icon + +::: + +## Breadcrumbs + +Page header allows you to add breadcrumbs for giving route information to the users by `breadcrumb` slot. + +:::demo + +page-header/breadcrumb + +::: + +## Additional operation section + +The header can be as complicated as needed, you may add additional sections to the header, to allow rich +interactions. + +:::demo + +page-header/additional-sections + +::: + +## Main content + +Sometimes we want the head to show with some co-responding content, we can utilize the `default` slot for doing so. + +:::demo + +page-header/main-content + +::: + +## Anatomy + +The component is consisted of these parts + +```vue +