-
Notifications
You must be signed in to change notification settings - Fork 0
breadcrumb: стилизация, сторисы, обёртки #20
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b88df7a
breadcrumb: стилизация, сторисы, обёртки
d138810
редактирование группы компонента
80b1c3b
единый источник данных; убраны локальные константы
3283798
Merge branch 'feature/styles-debug' into form.breadcrumb
khaliulin c3f4baf
убрал inline-сторисы Basic и IconsOnly; ре-экспорты из example-файлов
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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,19 @@ | ||
| import { Component, Input } from '@angular/core'; | ||
| import { Breadcrumb } from 'primeng/breadcrumb'; | ||
| import { MenuItem } from 'primeng/api'; | ||
|
|
||
| @Component({ | ||
| selector: 'breadcrumb', | ||
| standalone: true, | ||
| imports: [Breadcrumb], | ||
| template: ` | ||
| <p-breadcrumb | ||
| [model]="model" | ||
| [home]="home" | ||
| ></p-breadcrumb> | ||
| `, | ||
| }) | ||
| export class BreadcrumbComponent { | ||
| @Input() model: MenuItem[] = []; | ||
| @Input() home: MenuItem | undefined = undefined; | ||
| } |
This file contains hidden or 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,24 @@ | ||
| export const breadcrumbCss = ({ dt }: { dt: (token: string) => string }): string => ` | ||
| .p-breadcrumb-item-link { | ||
| padding: ${dt('breadcrumb.extend.extItem.padding')}; | ||
| font-size: ${dt('fonts.fontSize.200')}; | ||
| } | ||
|
|
||
| .p-breadcrumb-item-link:hover { | ||
| background: ${dt('breadcrumb.extend.hoverBackground')}; | ||
| } | ||
|
|
||
| .p-breadcrumb-item-icon { | ||
| font-size: ${dt('breadcrumb.extend.iconSize')}; | ||
| } | ||
|
|
||
| .p-breadcrumb-item:last-child .p-breadcrumb-item-link { | ||
| opacity: ${dt('opacity.500')}; | ||
| pointer-events: none; | ||
| cursor: default; | ||
| } | ||
|
|
||
| .p-breadcrumb-item:last-child .p-breadcrumb-item-link:hover { | ||
| background: ${dt('transparent')}; | ||
| } | ||
| `; |
This file contains hidden or 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,15 @@ | ||
| import { MenuItem } from 'primeng/api'; | ||
|
|
||
| export const commonHome: MenuItem = { icon: 'ti ti-home', url: '#' }; | ||
|
|
||
| export const commonItems: MenuItem[] = [ | ||
| { label: 'Электроника', icon: 'ti ti-device-laptop', url: '#' }, | ||
| { label: 'Компьютеры', icon: 'ti ti-cpu', url: '#' }, | ||
| { label: 'Ноутбуки' }, | ||
| ]; | ||
|
|
||
| export const iconOnlyItems: MenuItem[] = [ | ||
| { icon: 'ti ti-device-laptop', url: '#' }, | ||
| { icon: 'ti ti-cpu', url: '#' }, | ||
| { icon: 'ti ti-book' }, | ||
| ]; |
This file contains hidden or 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,75 @@ | ||
| import { Meta, StoryObj, moduleMetadata } from '@storybook/angular'; | ||
| import { BreadcrumbComponent } from '../../../lib/components/breadcrumb/breadcrumb.component'; | ||
| import { BreadcrumbBasicComponent, Basic } from './examples/breadcrumb-basic.component'; | ||
| import { BreadcrumbIconsOnlyComponent, IconsOnly } from './examples/breadcrumb-icons-only.component'; | ||
| import { commonHome, commonItems } from './breadcrumb.data'; | ||
|
|
||
| type BreadcrumbArgs = BreadcrumbComponent; | ||
|
|
||
| const meta: Meta<BreadcrumbArgs> = { | ||
| title: 'Components/Menu/Breadcrumb', | ||
| component: BreadcrumbComponent, | ||
| tags: ['autodocs'], | ||
| decorators: [ | ||
| moduleMetadata({ | ||
| imports: [ | ||
| BreadcrumbComponent, | ||
| BreadcrumbBasicComponent, | ||
| BreadcrumbIconsOnlyComponent, | ||
| ], | ||
| }), | ||
| ], | ||
| parameters: { | ||
| designTokens: { prefix: '--p-breadcrumb' }, | ||
| docs: { | ||
| description: { | ||
| component: `Компонент навигации, показывающий путь к текущей странице.`, | ||
| }, | ||
| }, | ||
| }, | ||
| argTypes: { | ||
| // ── Props ──────────────────────────────────────────────── | ||
| model: { | ||
| control: 'object', | ||
| description: 'Массив элементов меню', | ||
| table: { | ||
| category: 'Props', | ||
| type: { summary: 'MenuItem[]' }, | ||
| }, | ||
| }, | ||
| home: { | ||
| control: 'object', | ||
| description: 'Элемент для иконки «Домой»', | ||
| table: { | ||
| category: 'Props', | ||
| type: { summary: 'MenuItem' }, | ||
| }, | ||
| }, | ||
| }, | ||
| args: { | ||
| model: commonItems, | ||
| home: commonHome, | ||
| }, | ||
| }; | ||
|
|
||
| export default meta; | ||
| type Story = StoryObj<BreadcrumbArgs>; | ||
|
|
||
| // ── Default ────────────────────────────────────────────────────────────────── | ||
| export const Default: Story = { | ||
| name: 'Default', | ||
| render: (args) => ({ | ||
| props: args, | ||
| template: `<breadcrumb [model]="model" [home]="home"></breadcrumb>`, | ||
| }), | ||
| parameters: { | ||
| docs: { | ||
| description: { | ||
| story: 'Базовый пример компонента.', | ||
| }, | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| // ── Re-exports from example components ──────────────────────────────────── | ||
| export { Basic, IconsOnly }; | ||
56 changes: 56 additions & 0 deletions
56
src/stories/components/breadcrumb/examples/breadcrumb-basic.component.ts
This file contains hidden or 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,56 @@ | ||
| import { Component } from '@angular/core'; | ||
| import { StoryObj } from '@storybook/angular'; | ||
| import { BreadcrumbComponent } from '../../../../lib/components/breadcrumb/breadcrumb.component'; | ||
| import { commonHome, commonItems } from '../breadcrumb.data'; | ||
|
|
||
| const template = ` | ||
| <div class="bg-surface-ground"> | ||
| <breadcrumb [model]="model" [home]="home"></breadcrumb> | ||
| </div> | ||
| `; | ||
|
|
||
| @Component({ | ||
| selector: 'app-breadcrumb-basic', | ||
| standalone: true, | ||
| imports: [BreadcrumbComponent], | ||
| template, | ||
| }) | ||
| export class BreadcrumbBasicComponent { | ||
| home = commonHome; | ||
| model = commonItems; | ||
| } | ||
|
|
||
| export const Basic: StoryObj = { | ||
| render: () => ({ | ||
| template: `<app-breadcrumb-basic></app-breadcrumb-basic>`, | ||
| }), | ||
| parameters: { | ||
| docs: { | ||
| description: { story: 'Хлебные крошки с текстом и иконками.' }, | ||
| source: { | ||
| language: 'ts', | ||
| code: ` | ||
| import { Component } from '@angular/core'; | ||
| import { BreadcrumbComponent } from '@cdek-it/angular-ui-kit'; | ||
|
|
||
| @Component({ | ||
| selector: 'app-breadcrumb-basic', | ||
| standalone: true, | ||
| imports: [BreadcrumbComponent], | ||
| template: \` | ||
| <breadcrumb [model]="model" [home]="home"></breadcrumb> | ||
| \`, | ||
| }) | ||
| export class BreadcrumbBasicComponent { | ||
| home = { icon: 'ti ti-home', url: '#' }; | ||
| model = [ | ||
| { label: 'Электроника', icon: 'ti ti-device-laptop', url: '#' }, | ||
| { label: 'Компьютеры', icon: 'ti ti-cpu', url: '#' }, | ||
| { label: 'Ноутбуки' }, | ||
| ]; | ||
| } | ||
| `, | ||
| }, | ||
| }, | ||
| }, | ||
| }; |
56 changes: 56 additions & 0 deletions
56
src/stories/components/breadcrumb/examples/breadcrumb-icons-only.component.ts
This file contains hidden or 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,56 @@ | ||
| import { Component } from '@angular/core'; | ||
| import { StoryObj } from '@storybook/angular'; | ||
| import { BreadcrumbComponent } from '../../../../lib/components/breadcrumb/breadcrumb.component'; | ||
| import { commonHome, iconOnlyItems } from '../breadcrumb.data'; | ||
|
|
||
| const template = ` | ||
| <div class="bg-surface-ground"> | ||
| <breadcrumb [model]="model" [home]="home"></breadcrumb> | ||
| </div> | ||
| `; | ||
|
|
||
| @Component({ | ||
| selector: 'app-breadcrumb-icons-only', | ||
| standalone: true, | ||
| imports: [BreadcrumbComponent], | ||
| template, | ||
| }) | ||
| export class BreadcrumbIconsOnlyComponent { | ||
| home = commonHome; | ||
| model = iconOnlyItems; | ||
| } | ||
|
|
||
| export const IconsOnly: StoryObj = { | ||
| render: () => ({ | ||
| template: `<app-breadcrumb-icons-only></app-breadcrumb-icons-only>`, | ||
| }), | ||
| parameters: { | ||
| docs: { | ||
| description: { story: 'Хлебные крошки только с иконками, без текста.' }, | ||
| source: { | ||
| language: 'ts', | ||
| code: ` | ||
| import { Component } from '@angular/core'; | ||
| import { BreadcrumbComponent } from '@cdek-it/angular-ui-kit'; | ||
|
|
||
| @Component({ | ||
| selector: 'app-breadcrumb-icons-only', | ||
| standalone: true, | ||
| imports: [BreadcrumbComponent], | ||
| template: \` | ||
| <breadcrumb [model]="model" [home]="home"></breadcrumb> | ||
| \`, | ||
| }) | ||
| export class BreadcrumbIconsOnlyComponent { | ||
| home = { icon: 'ti ti-home', url: '#' }; | ||
| model = [ | ||
| { icon: 'ti ti-device-laptop', url: '#' }, | ||
| { icon: 'ti ti-cpu', url: '#' }, | ||
| { icon: 'ti ti-book' }, | ||
| ]; | ||
| } | ||
| `, | ||
| }, | ||
| }, | ||
| }, | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
и здесь компоненты не используются