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

fix(tab-title): tabs center when set to layout='center' #7026

Merged
merged 13 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
4 changes: 3 additions & 1 deletion src/components/tab-title/tab-title.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
:host([layout="center"]) {
@apply my-0 mx-5 text-center;
flex-basis: theme("spacing.48");
margin: auto;
.content {
@apply m-auto;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given that there's no difference between margin: auto and @apply m-auto I'd recommend using margin: auto it's more readable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're using tailwind for now, it makes sense to stick to tailwind classes if they are available, for consistency. This is what we've been doing so far. Also, overlapping uses of tailwind and regular css props might create oversight doubling use of both by accident.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, lets keep tailwind for now for consistency. Hopefully we can remove tailwind in the future.

}
}

:host([position="bottom"]) .container {
Expand Down
13 changes: 13 additions & 0 deletions src/components/tabs/tabs.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,19 @@ export const disabledTabsAndMediumIconsForLargeTabsTitle_TestOnly = (): string =
</calcite-tabs>
`;

export const centered_TestOnly = (): string => html`
<calcite-tabs layout="center">
<calcite-tab-nav slot="title-group">
<calcite-tab-title icon-start="arrow-left">Tab 1 Title</calcite-tab-title>
<calcite-tab-title icon-start="arrow-left">Tab 2 Title</calcite-tab-title>
<calcite-tab-title icon-start="arrow-left" selected>Tab 3 Title</calcite-tab-title>
</calcite-tab-nav>
<calcite-tab><p>Tab 1 Content</p></calcite-tab>
<calcite-tab><p>Tab 2 Content</p></calcite-tab>
<calcite-tab><p>Tab 3 Content</p></calcite-tab>
</calcite-tabs>
`;

export const TabChildrenWithPercentageHeights = (): string => html`
<calcite-tabs style="height: 250px;">
<calcite-tab-nav slot="title-group">
Expand Down