feat(theme-classic): make first tab the default tab (#5647)

* Initial work

* Little doc fix

* Doc fix
This commit is contained in:
Joshua Chen 2021-10-07 23:06:17 +08:00 committed by GitHub
parent 7b64e85dc3
commit d6b4eeb358
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 30 deletions

View file

@ -44,7 +44,8 @@ function TabsComponent(props: Props): JSX.Element {
});
const defaultValue =
defaultValueProp ??
children.find((child) => child.props.default)?.props.value;
children.find((child) => child.props.default)?.props.value ??
children[0]?.props.value;
const {tabGroupChoices, setTabGroupChoices} = useUserPreferencesContext();
const [selectedValue, setSelectedValue] = useState(defaultValue);