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: title for Tabs should be props.hint if provided #130

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Changes from all 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
2 changes: 1 addition & 1 deletion src/components/AdaptiveTabs/AdaptiveTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
const b = block('adaptive-tabs');
const TAB_CLASS_NAME = b('tab');
const getSortObjectKeysByValuesFunc =
(objectToSort: Record<string, any>) => (a: string, b: string) => {

Check warning on line 24 in src/components/AdaptiveTabs/AdaptiveTabs.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected any. Specify a different type

Check warning on line 24 in src/components/AdaptiveTabs/AdaptiveTabs.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

'b' is already declared in the upper scope on line 21 column 7
if (objectToSort[a] > objectToSort[b]) {
return 1;
}
Expand Down Expand Up @@ -66,7 +66,7 @@
class Tab extends React.Component<TabProps> {
render() {
const {active, disabled, hint, title = this.props.id} = this.props;
const stringTitle = (hint || typeof title === 'string' ? title : '') as string;
const stringTitle = hint ?? ((typeof title === 'string' && title) || '');
return (
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
<div
Expand Down Expand Up @@ -183,7 +183,7 @@
private tabsRootNode = React.createRef<HTMLDivElement>();
private tabsListNode = React.createRef<HTMLDivElement>();

get activeTab() {

Check warning on line 186 in src/components/AdaptiveTabs/AdaptiveTabs.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

getter functions should be placed after render
const {activeTab, items, allowNotSelected} = this.props;
if (activeTab) {
return activeTab;
Expand Down Expand Up @@ -211,7 +211,7 @@

this.breakpoints = Object.keys(props.breakpointsConfig)
.map(Number)
.sort((a, b) => a - b);

Check warning on line 214 in src/components/AdaptiveTabs/AdaptiveTabs.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

'b' is already declared in the upper scope on line 21 column 7

/* save the object, where the keys are the "name" of the current container width, the values are the maximum width of the tab for
the corresponding container width (in percent of the container width) */
Expand All @@ -225,7 +225,7 @@
breakpointName = LARGE_CONTAINER_WIDTH_NAME;
}

accum[breakpointName] = props.breakpointsConfig[currentBreakpointWidth] || 100;

Check warning on line 228 in src/components/AdaptiveTabs/AdaptiveTabs.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Assignment to property of function parameter 'accum'

return accum;
},
Expand All @@ -244,8 +244,8 @@
this.setState({currentContainerWidthName: this.getCurrentContainerWidthName()});

if (this.tabsRootNode.current.clientWidth > this.breakpoints[0]) {
if ((document as any).fonts) {

Check warning on line 247 in src/components/AdaptiveTabs/AdaptiveTabs.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected any. Specify a different type
(document as any).fonts.ready.then(this.initialCollectDimensions);

Check warning on line 248 in src/components/AdaptiveTabs/AdaptiveTabs.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected any. Specify a different type
} else if ((document as any).readyState === READY_STATE_COMPLETE) {
setTimeout(this.initialCollectDimensions, 0);
} else {
Expand Down
Loading