Skip to content

Commit 13f399c

Browse files
committed
chore: add labels, popover to theme switcher
1 parent 32dd863 commit 13f399c

1 file changed

Lines changed: 36 additions & 3 deletions

File tree

‎packages/documentation-framework/components/themeSelector/themeSelector.js‎

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useState } from 'react';
22
import {
3+
Content,
34
Select,
45
SelectGroup,
56
SelectList,
@@ -11,8 +12,11 @@ import {
1112
ToggleGroupItem,
1213
Icon,
1314
Divider,
14-
Label
15+
Label,
16+
Popover,
17+
Button
1518
} from '@patternfly/react-core';
19+
import { HelpIcon, ExternalLinkAltIcon } from '@patternfly/react-icons';
1620
import { useTheme, THEME_TYPES } from '../../hooks/useTheme';
1721

1822
const SunIcon = (
@@ -47,8 +51,37 @@ const DesktopIcon = (
4751
);
4852

4953
const HCGroupLabel = () => {
54+
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
55+
5056
return (
51-
<h2 className="pf-v6-c-menu__group-title">High contrast &nbsp;<Label color="blue" isCompact>Beta</Label></h2>
57+
<h2 className="pf-v6-c-menu__group-title">
58+
High contrast{' '}
59+
<Popover
60+
headerContent={"Under development"}
61+
headerComponent="h3"
62+
bodyContent={
63+
"We are still working to add high contrast support across all PatternFly components and extensions. This beta allows you to preview our progress."
64+
}
65+
footerContent={
66+
<Button icon={<ExternalLinkAltIcon />} component="a" isInline variant="link" href="https://medium.com/patternfly" target="_blank">
67+
Learn more (replace with link to blog post)
68+
</Button>
69+
}
70+
isVisible={isPopoverOpen}
71+
shouldClose={() => setIsPopoverOpen(false)}
72+
aria-label="More info about high contrast"
73+
appendTo={() => document.body}
74+
>
75+
<Button
76+
variant="plain"
77+
hasNoPadding
78+
icon={<HelpIcon />}
79+
onClick={() => setIsPopoverOpen(!isPopoverOpen)}
80+
aria-label="High contrast help"
81+
/>
82+
</Popover>{' '}&nbsp;
83+
<Label color="blue" isCompact>Beta</Label>
84+
</h2>
5285
)
5386
};
5487

@@ -111,7 +144,7 @@ export const ThemeSelector = ({ id }) => {
111144
shouldFocusToggleOnSelect
112145
onOpenChangeKeys={['Escape']}
113146
>
114-
<SelectGroup>
147+
<SelectGroup label={'Color scheme'} labelHeadingLevel="h2">
115148
<SelectList aria-label="Light/Dark theme switcher">
116149
<SelectOption value={colorModes.SYSTEM} icon={DesktopIcon} description="Follow system preference">
117150
System

0 commit comments

Comments
 (0)