Skip to content

Commit

Permalink
fix(tabs-actions): pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
dtsanevmw committed Nov 21, 2024
1 parent 7898bb2 commit a23b3a0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
12 changes: 11 additions & 1 deletion .storybook/stories/tabs/tabs-actions.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default {
argTypes: {
// inputs
clrLayout: { control: 'inline-radio', options: TabsLayout },
tabsActionsPosition: { control: 'inline-radio', options: ['left', 'right'] },
// methods
closeOnEscapeKey: { control: { disable: true }, table: { disable: true } },
closeOnFocusOut: { control: { disable: true }, table: { disable: true } },
Expand All @@ -38,6 +39,7 @@ export default {
args: {
// inputs
clrLayout: TabsLayout.HORIZONTAL,
tabsActionsPosition: 'right',
// story helpers
createArray: n => new Array(n),
clickTabAction: () => alert('Tab action clicked!'),
Expand All @@ -51,7 +53,7 @@ export default {
const tabsTemplate: StoryFn = args => ({
template: `
<clr-tabs [clrLayout]="clrLayout">
<clr-tabs-actions position="right">
<clr-tabs-actions [position]="tabsActionsPosition">
<button class="btn btn-icon btn-link" (click)="clickTabAction()" clrTabAction>
<cds-icon shape="plus"></cds-icon>
Tab Action
Expand All @@ -75,6 +77,7 @@ export const Tabs: StoryObj = {
export const VerticalTabs: StoryObj = {
render: tabsTemplate,
args: {
tabsActionsPosition: 'left',
clrLayout: TabsLayout.VERTICAL,
},
};
Expand All @@ -87,3 +90,10 @@ export const TabsResponsive: StoryObj = {
},
},
};

export const TabsActionsLeft: StoryObj = {
render: tabsTemplate,
args: {
tabsActionsPosition: 'left',
},
};
4 changes: 1 addition & 3 deletions projects/angular/clarity.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4113,12 +4113,10 @@ export class ClrTabs implements AfterContentInit, OnDestroy {

// @public (undocumented)
export class ClrTabsActions {
// (undocumented)
actions: QueryList<ElementRef>;
// (undocumented)
position: ClrTabsActionsPosition;
// (undocumented)
static ɵcmp: i0.ɵɵComponentDeclaration<ClrTabsActions, "clr-tabs-actions", never, { "position": "position"; }, {}, ["actions"], ["*"], false, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<ClrTabsActions, "clr-tabs-actions", never, { "position": "position"; }, {}, never, ["*"], false, never>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<ClrTabsActions, never>;
}
Expand Down
6 changes: 1 addition & 5 deletions projects/angular/src/layout/tabs/tabs-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
* The full license information can be found in LICENSE in the root directory of this project.
*/

import { Component, ContentChildren, ElementRef, HostBinding, Input, QueryList } from '@angular/core';

import { ClrTabAction } from './tab-action.directive';
import { Component, HostBinding, Input } from '@angular/core';

export type ClrTabsActionsPosition = 'left' | 'right';

Expand All @@ -26,6 +24,4 @@ export class ClrTabsActions {
@Input()
@HostBinding('attr.position')
position: ClrTabsActionsPosition = 'right';

@ContentChildren(ClrTabAction, { read: ElementRef }) actions: QueryList<ElementRef>;
}

0 comments on commit a23b3a0

Please sign in to comment.