-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ui): Clean Breadcrumbs styles (#29361)
### Parent Issue #29360 ### Proposed Changes * Apply breadcrumb styles only to DotCrumbtrailComponent without affecting the base component * Create a Storybook for DotCrumbtrailComponent * Create a Storybook for Breadcrumbs from PrimeNG ### Checklist - [x] Tests - [x] Translations - [x] Security Implications Contemplated (add notes if applicable) ### Problem The current Breadcumbs is used in the toolbar like this: Toobar | Toolbar :-------------------------:|:-------------------------: <img width="697" alt="Screenshot 2024-07-26 at 9 46 41 AM" src="https://github.com/user-attachments/assets/57919615-5738-4fb0-aae1-4beec4b3a22d"> | <img width="645" alt="Screenshot 2024-07-26 at 9 46 32 AM" src="https://github.com/user-attachments/assets/9b5d34cb-6698-427a-ae3f-4311c9833406"> But these styles don't work well if we want to use a simple breadcrumb in another section. <img width="1056" alt="Screenshot 2024-07-26 at 9 52 20 AM" src="https://github.com/user-attachments/assets/2d51f0be-96ad-4807-8015-cfef54423e9e"> ### Screenshots Now that we separate the styles, we keep the styles for the toolbar and allow this component to be used in other sections without toolbar styles. DotCrumbtrailComponent <img width="1037" alt="Screenshot 2024-07-26 at 9 59 31 AM" src="https://github.com/user-attachments/assets/900ca684-3ec9-4f4b-b3a2-795a6c7137a9"> Breadcrumbs <img width="1070" alt="Screenshot 2024-07-26 at 9 59 57 AM" src="https://github.com/user-attachments/assets/05b4cad6-ac42-46e0-8c60-48728017ad30">
- Loading branch information
Showing
7 changed files
with
504 additions
and
470 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
core-web/apps/dotcms-ui/src/stories/dotcms/menu/DotCrumbtrail.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { Meta, StoryObj, moduleMetadata, componentWrapperDecorator } from '@storybook/angular'; | ||
import { of } from 'rxjs'; | ||
|
||
import { DotCrumbtrailComponent } from '@components/dot-crumbtrail/dot-crumbtrail.component'; | ||
import { DotCrumbtrailModule } from '@components/dot-crumbtrail/dot-crumbtrail.module'; | ||
import { DotCrumbtrailService } from '@components/dot-crumbtrail/service/dot-crumbtrail.service'; | ||
|
||
type Args = DotCrumbtrailComponent; | ||
|
||
const meta: Meta<Args> = { | ||
title: 'DotCMS/Menu/DotCrumbtrail', | ||
component: DotCrumbtrailComponent, | ||
decorators: [ | ||
moduleMetadata({ | ||
imports: [DotCrumbtrailModule], | ||
providers: [ | ||
{ | ||
provide: DotCrumbtrailService, | ||
useValue: { | ||
crumbTrail$: of([ | ||
{ | ||
label: 'Site', | ||
target: '_self', | ||
url: '#//pages' | ||
}, | ||
{ | ||
label: 'Pages', | ||
target: '_self', | ||
url: '#//pages' | ||
}, | ||
{ | ||
label: 'Apparel', | ||
target: '_self', | ||
url: '' | ||
} | ||
]) | ||
} | ||
} | ||
] | ||
}), | ||
componentWrapperDecorator( | ||
(story) => `<div class="card flex justify-content-center">${story}</div>` | ||
) | ||
], | ||
parameters: { | ||
layout: 'centered', | ||
docs: { | ||
description: { | ||
component: | ||
'Breadcrumb provides contextual information about page hierarchy.: https://primefaces.org/primeng/showcase/#/breadcrumb' | ||
} | ||
} | ||
}, | ||
render: () => { | ||
return { | ||
template: `<dot-crumbtrail class="max-w-full" />` | ||
}; | ||
} | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<Args>; | ||
|
||
export const Default: Story = {}; |
76 changes: 43 additions & 33 deletions
76
core-web/apps/dotcms-ui/src/stories/primeng/menu/Breadcrumb.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,60 @@ | ||
import { Meta, moduleMetadata, Story } from '@storybook/angular'; | ||
import { | ||
Meta, | ||
StoryObj, | ||
moduleMetadata, | ||
componentWrapperDecorator, | ||
argsToTemplate | ||
} from '@storybook/angular'; | ||
|
||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | ||
import { Breadcrumb, BreadcrumbModule } from 'primeng/breadcrumb'; | ||
|
||
import { BreadcrumbModule } from 'primeng/breadcrumb'; | ||
type Args = Breadcrumb; | ||
|
||
export default { | ||
const meta: Meta<Args> = { | ||
title: 'PrimeNG/Menu/Breadcrumbs', | ||
component: Breadcrumb, | ||
decorators: [ | ||
moduleMetadata({ | ||
imports: [BreadcrumbModule] | ||
}), | ||
componentWrapperDecorator( | ||
(story) => `<div class="card flex justify-content-center">${story}</div>` | ||
) | ||
], | ||
parameters: { | ||
layout: 'centered', | ||
docs: { | ||
description: { | ||
component: | ||
'Breadcrumb provides contextual information about page hierarchy.: https://primefaces.org/primeng/showcase/#/breadcrumb' | ||
} | ||
} | ||
}, | ||
decorators: [ | ||
moduleMetadata({ | ||
imports: [BreadcrumbModule, BrowserAnimationsModule] | ||
}) | ||
], | ||
args: { | ||
items: [ | ||
{ label: 'Content Model', url: '#' }, | ||
{ label: 'Content Types' }, | ||
{ label: 'Store Product List', url: '#' } | ||
] | ||
model: [ | ||
{ label: 'Electronics', url: '/' }, | ||
{ label: 'Computer', url: '/' }, | ||
{ label: 'Accessories', url: '/' }, | ||
{ label: 'Keyboard', url: '/' }, | ||
{ label: 'Wireless', url: '/' } | ||
], | ||
home: { icon: 'pi pi-home' } | ||
}, | ||
argTypes: { | ||
model: { description: 'Defines the data' } | ||
}, | ||
render: (args: Args) => { | ||
return { | ||
props: { | ||
...args | ||
}, | ||
template: `<p-breadcrumb class="max-w-full" ${argsToTemplate(args)} />` | ||
}; | ||
} | ||
} as Meta; | ||
|
||
const BreadcrumbTemplate = `<p-breadcrumb [model]="items"></p-breadcrumb>`; | ||
|
||
const Template: Story<{ label: string; url: string }> = (props: { label: string; url: string }) => { | ||
const template = BreadcrumbTemplate; | ||
|
||
return { | ||
props, | ||
template | ||
}; | ||
}; | ||
|
||
export const Basic: Story = Template.bind({}); | ||
export default meta; | ||
|
||
Basic.parameters = { | ||
docs: { | ||
source: { | ||
code: BreadcrumbTemplate | ||
} | ||
} | ||
}; | ||
type Story = StoryObj<Args>; | ||
|
||
export const Default: Story = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.