Attempt to automatically select OS tab based on user user-agent

This is a quick fix to attempt to automatically select the user's OS tab
on the pages that requires so which potentially avoids users following
incorrect docs

Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
This commit is contained in:
Marcos Lilljedahl 2022-03-23 13:59:39 -03:00
parent 323f01278a
commit b47b51401f
2 changed files with 5 additions and 2 deletions

View File

@ -32,7 +32,7 @@ You can use a local socket in an action:
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
<Tabs defaultValue="unix" groupId="client-env">
<Tabs defaultValue={window.navigator.userAgent.indexOf('Win') != -1 ? 'windows': 'unix'} groupId="client-env">
<TabItem value="unix" label="Linux/macOS">

View File

@ -12,7 +12,10 @@ Within 5 minutes, you will have a local CI/CD loop and run your first test & bui
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
<Tabs defaultValue="macos"
<Tabs defaultValue={
window.navigator.userAgent.indexOf('Linux') != -1 ? 'linux':
window.navigator.userAgent.indexOf('Win') != -1 ? 'windows':
'macos'}
groupId="os"
values={[
{label: 'macOS', value: 'macos'}, {label: 'Linux', value: 'linux'}, {label: 'Windows', value: 'windows'},