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

Feature: Added large tab size to react-tabs #25577

Merged
merged 4 commits into from
Nov 9, 2022
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Added large size tabs",
"packageName": "@fluentui/react-tabs",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fixed incorrect typography style",
"packageName": "@fluentui/react-theme",
"email": "[email protected]",
"dependentChangeType": "patch"
}
4 changes: 2 additions & 2 deletions packages/react-components/react-tabs/etc/react-tabs.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export type TabListProps = ComponentProps<TabListSlots> & {
disabled?: boolean;
onTabSelect?: SelectTabEventHandler;
selectedValue?: TabValue;
size?: 'small' | 'medium';
size?: 'small' | 'medium' | 'large';
vertical?: boolean;
};

Expand Down Expand Up @@ -105,7 +105,7 @@ export type TabState = ComponentState<TabSlots> & Pick<TabProps, 'value'> & Requ
iconOnly: boolean;
selected: boolean;
contentReservedSpaceClassName?: string;
size: 'small' | 'medium';
size: 'small' | 'medium' | 'large';
vertical: boolean;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ describe('Tab', () => {
['vertical', { ...defaultContext, vertical: true }],
['small size', { ...defaultContext, size: 'small' }],
['small size and vertical', { ...defaultContext, size: 'small', vertical: true }],
['medium size', { ...defaultContext, size: 'medium' }],
['medium size and vertical', { ...defaultContext, size: 'medium', vertical: true }],
['large size', { ...defaultContext, size: 'large' }],
['large size and vertical', { ...defaultContext, size: 'large', vertical: true }],
])('renders %s correctly with icon slotted', (_testName, tabList) => {
const contextValues = {
tabList: tabList as TabListContextValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ export type TabState = ComponentState<TabSlots> &
*/
contentReservedSpaceClassName?: string;
/**
* A tab can be either 'small' or 'medium' size.
* A tab can be either 'small', 'medium', or 'large' size.
*/
size: 'small' | 'medium';
size: 'small' | 'medium' | 'large';
/**
* A tab can arrange its content based on if the tabs in the list are arranged vertically.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,154 @@ exports[`Tab renders default correctly with icon slotted 1`] = `
</div>
`;

exports[`Tab renders large size and vertical correctly with icon slotted 1`] = `
<div>
<button
aria-selected="false"
class="fui-Tab"
role="tab"
style="--fui-Tab__indicator--offset: 0px; --fui-Tab__indicator--scale: 1;"
type="button"
value="1"
>
<span
class="fui-Tab__icon"
>
<svg
aria-hidden="true"
class=""
fill="currentColor"
height="1em"
viewBox="0 0 20 20"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M14.5 3A2.5 2.5 0 0117 5.5v9a2.5 2.5 0 01-2.5 2.5h-9A2.5 2.5 0 013 14.5v-9A2.5 2.5 0 015.5 3h9zm0 1h-9C4.67 4 4 4.67 4 5.5v9c0 .83.67 1.5 1.5 1.5h9c.83 0 1.5-.67 1.5-1.5v-9c0-.83-.67-1.5-1.5-1.5zM7 11a1 1 0 110 2 1 1 0 010-2zm3 0a1 1 0 110 2 1 1 0 010-2zM7 7a1 1 0 110 2 1 1 0 010-2zm3 0a1 1 0 110 2 1 1 0 010-2zm3 0a1 1 0 110 2 1 1 0 010-2z"
fill="currentColor"
/>
</svg>
</span>
<span
class="fui-Tab__content"
>
Default Tab
</span>
</button>
</div>
`;

exports[`Tab renders large size correctly with icon slotted 1`] = `
<div>
<button
aria-selected="false"
class="fui-Tab"
role="tab"
style="--fui-Tab__indicator--offset: 0px; --fui-Tab__indicator--scale: 1;"
type="button"
value="1"
>
<span
class="fui-Tab__icon"
>
<svg
aria-hidden="true"
class=""
fill="currentColor"
height="1em"
viewBox="0 0 20 20"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M14.5 3A2.5 2.5 0 0117 5.5v9a2.5 2.5 0 01-2.5 2.5h-9A2.5 2.5 0 013 14.5v-9A2.5 2.5 0 015.5 3h9zm0 1h-9C4.67 4 4 4.67 4 5.5v9c0 .83.67 1.5 1.5 1.5h9c.83 0 1.5-.67 1.5-1.5v-9c0-.83-.67-1.5-1.5-1.5zM7 11a1 1 0 110 2 1 1 0 010-2zm3 0a1 1 0 110 2 1 1 0 010-2zM7 7a1 1 0 110 2 1 1 0 010-2zm3 0a1 1 0 110 2 1 1 0 010-2zm3 0a1 1 0 110 2 1 1 0 010-2z"
fill="currentColor"
/>
</svg>
</span>
<span
class="fui-Tab__content"
>
Default Tab
</span>
</button>
</div>
`;

exports[`Tab renders medium size and vertical correctly with icon slotted 1`] = `
<div>
<button
aria-selected="false"
class="fui-Tab"
role="tab"
style="--fui-Tab__indicator--offset: 0px; --fui-Tab__indicator--scale: 1;"
type="button"
value="1"
>
<span
class="fui-Tab__icon"
>
<svg
aria-hidden="true"
class=""
fill="currentColor"
height="1em"
viewBox="0 0 20 20"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M14.5 3A2.5 2.5 0 0117 5.5v9a2.5 2.5 0 01-2.5 2.5h-9A2.5 2.5 0 013 14.5v-9A2.5 2.5 0 015.5 3h9zm0 1h-9C4.67 4 4 4.67 4 5.5v9c0 .83.67 1.5 1.5 1.5h9c.83 0 1.5-.67 1.5-1.5v-9c0-.83-.67-1.5-1.5-1.5zM7 11a1 1 0 110 2 1 1 0 010-2zm3 0a1 1 0 110 2 1 1 0 010-2zM7 7a1 1 0 110 2 1 1 0 010-2zm3 0a1 1 0 110 2 1 1 0 010-2zm3 0a1 1 0 110 2 1 1 0 010-2z"
fill="currentColor"
/>
</svg>
</span>
<span
class="fui-Tab__content"
>
Default Tab
</span>
</button>
</div>
`;

exports[`Tab renders medium size correctly with icon slotted 1`] = `
<div>
<button
aria-selected="false"
class="fui-Tab"
role="tab"
style="--fui-Tab__indicator--offset: 0px; --fui-Tab__indicator--scale: 1;"
type="button"
value="1"
>
<span
class="fui-Tab__icon"
>
<svg
aria-hidden="true"
class=""
fill="currentColor"
height="1em"
viewBox="0 0 20 20"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M14.5 3A2.5 2.5 0 0117 5.5v9a2.5 2.5 0 01-2.5 2.5h-9A2.5 2.5 0 013 14.5v-9A2.5 2.5 0 015.5 3h9zm0 1h-9C4.67 4 4 4.67 4 5.5v9c0 .83.67 1.5 1.5 1.5h9c.83 0 1.5-.67 1.5-1.5v-9c0-.83-.67-1.5-1.5-1.5zM7 11a1 1 0 110 2 1 1 0 010-2zm3 0a1 1 0 110 2 1 1 0 010-2zM7 7a1 1 0 110 2 1 1 0 010-2zm3 0a1 1 0 110 2 1 1 0 010-2zm3 0a1 1 0 110 2 1 1 0 010-2z"
fill="currentColor"
/>
</svg>
</span>
<span
class="fui-Tab__content"
>
Default Tab
</span>
</button>
</div>
`;

exports[`Tab renders small size and vertical correctly with icon slotted 1`] = `
<div>
<button
Expand Down
Loading