Skip to content
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

chore(storybook): add stories for header for smaller screens #977

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
534dcc1
fix(alert): remove hostBinding and use renderer for alert-hidden clas…
valentin-mladenov Oct 3, 2023
aa69d8b
chore: add v16 to issue template (#974)
jerone Oct 4, 2023
656ca9b
fix(modal): update title font-family variable (#981)
williamernest Oct 9, 2023
514432c
fix(card): update card header to correct font-weight (#980)
williamernest Oct 9, 2023
984d6ec
fix(header): add correct header title font-weight value (#979)
williamernest Oct 9, 2023
7e5f164
chore(storybook): refactor signpost stories to csf (#943)
williamernest Oct 12, 2023
e7efe73
fix(accordion): update event type and add descriptions (#1005)
williamernest Oct 17, 2023
9f26b10
chore(accordion): update storybook stories to csfv3 (#996)
williamernest Oct 17, 2023
a8024dc
fix(vertical-nav): align nav parent/child left padding (#1000)
williamernest Oct 17, 2023
479f7b3
chore(storybook): add tabs collapsed story to test smaller screens (#…
mivaylo Oct 18, 2023
04a12dd
fix(datagrid): align checkbox with text in datagrid (#1006)
valentin-mladenov Oct 18, 2023
0e62fd6
fix(datagrid): update manage columns dialog close button color (#1008)
williamernest Oct 18, 2023
33d25ed
chore(vertical-nav): update routing story to include all top level it…
williamernest Oct 27, 2023
5ce535b
fix(label): remove has pseudo class selector (port of #1020) (#1024)
valentin-mladenov Oct 31, 2023
10f32c1
chore(storybook): temp
mivaylo Oct 2, 2023
d973e47
chore(storybook): add stories for header for smaller screens
mivaylo Oct 2, 2023
b6b0caf
chore(storybook): get rid of obsolete story
mivaylo Oct 3, 2023
dce434e
chore(storybook): remove obsolete viewport
mivaylo Oct 31, 2023
96d30de
chore(storybook): test viewport for visual snapshots
mivaylo Oct 31, 2023
ea70870
Revert "chore(storybook): test viewport for visual snapshots"
mivaylo Oct 31, 2023
63da4eb
chore: update visual snapshots for `add-story-for-header-navigation`
web-flow Oct 31, 2023
ec575aa
fix(tree-view): remove has css selector (port of #1020) (#1023)
valentin-mladenov Oct 31, 2023
0164f85
fix(signpost): allow keyboard scrolling in overflow content (#1027)
dtsanevmw Oct 31, 2023
a2c8dbd
Merge branch 'main' into add-story-for-header-navigation
mivaylo Oct 31, 2023
3c99243
chore: update visual snapshots for `add-story-for-header-navigation`
web-flow Oct 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,20 @@ _A clear and concise description of what you expected to happen._

**Clarity version:**

- [ ] v13.x
- [ ] v15.x
- [ ] v16.x
- [ ] Other:

**Framework version:**
_ie: Angular 15_

_ie: Angular 16_

**Device:**

- Type: [e.g. MacBook]
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
- Browser: [e.g. chrome, safari]
- Version: [e.g. 22]

## Additional notes

Expand Down
11 changes: 11 additions & 0 deletions .storybook/helpers/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright (c) 2016-2023 VMware, Inc. All Rights Reserved.
* This software is released under MIT license.
* The full license information can be found in LICENSE in the root directory of this project.
*/

import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

export const CommonModules = [CommonModule, BrowserAnimationsModule, FormsModule, ReactiveFormsModule];
50 changes: 50 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,51 @@ const cdsCoreAndShimStyles = [previewStyles, resetStyles, coreTokens, darkThemeC
loadIcons();
addDocs(docs);

const customViewports = {
large: {
name: 'CLR Large',
styles: {
width: '992px',
height: '100%',
},
},
medium: {
name: 'CLR Medium',
styles: {
width: '768px',
height: '100%',
},
},
small: {
name: 'CLR Small',
styles: {
width: '576px',
height: '100%',
},
},
smallMobile: {
name: 'Small mobile',
styles: {
width: '320px',
height: '568px',
},
},
largeMobile: {
name: 'Large mobile',
styles: {
width: '414px',
height: '896px',
},
},
tablet: {
name: 'Tablet',
styles: {
width: '834px',
height: '1112px',
},
},
};

export const parameters = {
docs: { inlineStories: true },
options: {
Expand All @@ -43,6 +88,11 @@ export const parameters = {
order: ['Home'],
},
},
viewport: {
viewports: {
...customViewports,
},
},
};

export const globalTypes = {
Expand Down
63 changes: 35 additions & 28 deletions .storybook/stories/accordion/accordion-panel.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@

import { ClrAccordionModule, ClrAccordionPanel } from '@clr/angular';
import { action } from '@storybook/addon-actions';
import { Parameters } from '@storybook/addons';
import { Story } from '@storybook/angular';
import { moduleMetadata, Story } from '@storybook/angular';

import { setupStorybook } from '../../helpers/setup-storybook.helpers';
import { CommonModules } from '../../helpers/common';

const defaultStory: Story = args => ({
template: `
const template = `
<clr-accordion>
<clr-accordion-panel
[clrAccordionPanelOpen]="clrAccordionPanelOpen"
Expand All @@ -23,49 +21,58 @@ const defaultStory: Story = args => ({
<clr-accordion-content>{{ content }}</clr-accordion-content>
</clr-accordion-panel>
</clr-accordion>
`,
props: { ...args },
});
`;

const defaultParameters: Parameters = {
export default {
title: 'Accordion/Accordion Panel',
component: ClrAccordionPanel,
argTypes: {
// outputs
clrAccordionPanelOpenChange: { control: { disable: true } },
title: { description: 'Rendered within the `<clr-accordion-title>` element' },
content: { description: 'Rendered within the `<clr-accordion-content>` element' },
// methods
togglePanel: { control: { disable: true } },
collapsePanelOnAnimationDone: { control: { disable: true }, table: { disable: true } },
getAccordionContentId: { control: { disable: true }, table: { disable: true } },
getAccordionHeaderId: { control: { disable: true }, table: { disable: true } },
getPanelStateClasses: { control: { disable: true }, table: { disable: true } },
},
decorators: [
moduleMetadata({
imports: [...CommonModules, ClrAccordionModule],
}),
],
args: {
// outputs
clrAccordionPanelOpenChange: action('clrAccordionPanelOpenChange'),
// story helpers
title: 'Title',
content: 'Hello World!',
},
};

const variants: Parameters[] = [
{
clrAccordionPanelOpen: false,
clrAccordionPanelDisabled: false,
},
{
clrAccordionPanelOpen: false,
clrAccordionPanelDisabled: true,
},
{
clrAccordionPanelOpen: true,
clrAccordionPanelDisabled: false,
},
{
clrAccordionPanelOpen: true,
clrAccordionPanelDisabled: true,
},
];
};

export const PanelClosed: Story = args => ({
template,
props: args,
});

export const PanelOpened: Story = PanelClosed.bind({});
PanelOpened.args = {
...PanelClosed.args,
clrAccordionPanelOpen: true,
};

export const PanelClosedDisabled: Story = PanelClosed.bind({});
PanelClosedDisabled.args = {
...PanelClosed.args,
clrAccordionPanelDisabled: true,
};

setupStorybook(ClrAccordionModule, defaultStory, defaultParameters, variants);
export const PanelOpenedDisabled: Story = PanelOpened.bind({});
PanelOpenedDisabled.args = {
...PanelOpened.args,
clrAccordionPanelDisabled: true,
};
86 changes: 39 additions & 47 deletions .storybook/stories/accordion/accordion.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,18 @@
*/

import { ClrAccordion, ClrAccordionModule } from '@clr/angular';
import { Parameters } from '@storybook/addons';
import { Story } from '@storybook/angular';
import { moduleMetadata, Story } from '@storybook/angular';

import { setupStorybook } from '../../helpers/setup-storybook.helpers';
import { CommonModules } from '../../helpers/common';

const defaultStory: Story = args => ({
template: `
<clr-accordion [clrAccordionMultiPanel]="clrAccordionMultiPanel">
<clr-accordion-panel
*ngFor="let _ of createArray(panelCount); let i = index"
[clrAccordionPanelOpen]="!!openIndices[i]"
>
<clr-accordion-title>{{title}} {{i + 1}}</clr-accordion-title>
<clr-accordion-content>{{content}} {{i + 1}}</clr-accordion-content>
</clr-accordion-panel>
</clr-accordion>
`,
props: { ...args },
});

const defaultParameters: Parameters = {
export default {
title: 'Accordion/Accordion',
component: ClrAccordion,
decorators: [
moduleMetadata({
imports: [...CommonModules, ClrAccordionModule],
}),
],
argTypes: {
// inputs
clrAccordionMultiPanel: { defaultValue: false, control: { type: 'boolean' } },
Expand All @@ -46,32 +35,35 @@ const defaultParameters: Parameters = {
},
};

const variants: Parameters[] = [
{
clrAccordionMultiPanel: false,
panelCount: 4,
openIndices: [],
},
{
clrAccordionMultiPanel: false,
panelCount: 4,
openIndices: [true],
},
{
clrAccordionMultiPanel: false,
panelCount: 4,
openIndices: [false, false, false, true],
},
{
clrAccordionMultiPanel: true,
panelCount: 4,
openIndices: [false, true, true, false],
},
{
clrAccordionMultiPanel: true,
panelCount: 4,
openIndices: [true, true, true, true],
},
];
const template = `
<clr-accordion [clrAccordionMultiPanel]="clrAccordionMultiPanel">
<clr-accordion-panel
*ngFor="let _ of createArray(panelCount); let i = index"
[clrAccordionPanelOpen]="!!openIndices[i]"
>
<clr-accordion-title>{{title}} {{i + 1}}</clr-accordion-title>
<clr-accordion-content>{{content}} {{i + 1}}</clr-accordion-content>
</clr-accordion-panel>
</clr-accordion>
`;

export const Initial: Story = args => ({
template,
props: args,
});

setupStorybook(ClrAccordionModule, defaultStory, defaultParameters, variants);
export const SinglePanelOpened: Story = Initial.bind({});
SinglePanelOpened.args = {
...Initial.args,
openIndices: [true, false, false, false],
};

export const MultiplePanelsOpened: Story = Initial.bind({});
MultiplePanelsOpened.argTypes = {
...Initial.argTypes,
clrAccordionMultiPanel: { defaultValue: true, control: { disable: true } },
};
MultiplePanelsOpened.args = {
...Initial.args,
openIndices: [true, true, false, false],
};
71 changes: 36 additions & 35 deletions .storybook/stories/accordion/nested-accordion.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,34 @@
*/

import { ClrAccordionModule } from '@clr/angular';
import { Parameters } from '@storybook/addons';
import { Story } from '@storybook/angular';
import { moduleMetadata, Story } from '@storybook/angular';

import { setupStorybook } from '../../helpers/setup-storybook.helpers';
import { CommonModules } from '../../helpers/common';

const defaultStory: Story = args => ({
template: `
export default {
title: 'Accordion/Nested Accordion',
argTypes: {
// story helpers
openIndex: { control: { disable: true }, table: { disable: true } },
nestedOpenIndex: { control: { disable: true }, table: { disable: true } },
createArray: { control: { disable: true }, table: { disable: true } },
panelCount: { control: { type: 'number', min: 1, max: 100 } },
},
decorators: [
moduleMetadata({
imports: [...CommonModules, ClrAccordionModule],
}),
],
args: {
// story helpers
openIndex: undefined,
nestedOpenIndex: undefined,
createArray: n => new Array(n),
panelCount: 4,
},
};

const template = `
<clr-accordion>
<clr-accordion-panel
*ngFor="let _ of createArray(panelCount); let i = index"
Expand All @@ -28,36 +49,16 @@ const defaultStory: Story = args => ({
</clr-accordion-content>
</clr-accordion-panel>
</clr-accordion>
`,
props: { ...args },
`;

export const Closed: Story = args => ({
template,
props: args,
});

const defaultParameters: Parameters = {
title: 'Accordion/Nested Accordion',
argTypes: {
// story helpers
openIndex: { control: { disable: true }, table: { disable: true } },
nestedOpenIndex: { control: { disable: true }, table: { disable: true } },
createArray: { control: { disable: true }, table: { disable: true } },
panelCount: { control: { type: 'number', min: 1, max: 100 } },
},
args: {
// story helpers
openIndex: undefined,
nestedOpenIndex: undefined,
createArray: n => new Array(n),
panelCount: 4,
},
export const Opened: Story = Closed.bind({});
Opened.args = {
...Closed.args,
openIndex: 0,
nestedOpenIndex: 0,
};

const variants: Parameters[] = [
{
openIndex: 0,
},
{
openIndex: 0,
nestedOpenIndex: 0,
},
];

setupStorybook(ClrAccordionModule, defaultStory, defaultParameters, variants);
Loading
Loading