Skip to content

Commit 2cf9ff8

Browse files
authored
fix(nav): docs site navigation (#4083)
* fix(mobile-nav): horizontal scroll issue on header * feat(mobile-nav): update mobile paste logo * feat(mobile-nav): fix build issue * feat(mobile-nav): update search bar height
1 parent fc1163f commit 2cf9ff8

File tree

2 files changed

+14
-30
lines changed

2 files changed

+14
-30
lines changed

packages/paste-website/src/components/site-wrapper/site-header/SiteHeaderLogo.tsx

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import * as React from "react";
88

99
import { event } from "../../../lib/gtag";
1010
import { PasteIcon } from "../../icons/PasteIcon";
11-
import { PasteIconPride } from "../../icons/PasteIconPride";
1211

1312
const LogoLink = styled(Link)`
1413
position: relative;
@@ -37,10 +36,6 @@ interface SiteHeaderLogoProps {
3736
*/
3837
const SiteHeaderLogo: React.FC<React.PropsWithChildren<SiteHeaderLogoProps>> = ({ title, subtitle }) => {
3938
const theme = useTheme();
40-
const [logoOpacity, setLogoOpacity] = React.useState(1);
41-
const [hoverOpacity, setHoverOpacity] = React.useState(0);
42-
const logoTransition = "ease-out 350ms";
43-
4439
return (
4540
<Box display="flex" alignItems="center" minWidth={subtitle ? "sizeSidebar" : "size0"}>
4641
<LogoLink
@@ -52,28 +47,10 @@ const SiteHeaderLogo: React.FC<React.PropsWithChildren<SiteHeaderLogoProps>> = (
5247
label: "Paste logo",
5348
})
5449
}
55-
onMouseEnter={() => {
56-
setLogoOpacity(0);
57-
setHoverOpacity(1);
58-
}}
59-
onMouseLeave={() => {
60-
setLogoOpacity(1);
61-
setHoverOpacity(0);
62-
}}
6350
>
6451
<MediaObject verticalAlign="center">
6552
<MediaFigure spacing="space40">
66-
<PasteIconPride display="block" size={42} transition={logoTransition} opacity={logoOpacity} />
67-
<PasteIcon
68-
color={theme.textColors.colorTextBrandHighlight}
69-
opacity={hoverOpacity}
70-
transition={logoTransition}
71-
display="block"
72-
position="absolute"
73-
top="0"
74-
left="0"
75-
size={42}
76-
/>
53+
<PasteIcon color={theme.textColors.colorTextBrandHighlight} display="block" size={38} />
7754
</MediaFigure>
7855
<MediaBody>
7956
<Text as="div" fontSize="fontSize40" lineHeight="lineHeight30" color="colorText">

packages/paste-website/src/components/site-wrapper/site-header/SiteHeaderSearch.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ import { SearchIcon } from "@twilio-paste/icons/esm/SearchIcon";
44
import { InlineCode } from "@twilio-paste/inline-code";
55
import { ScreenReaderOnly } from "@twilio-paste/screen-reader-only";
66
import { Text } from "@twilio-paste/text";
7+
import { useWindowSize } from "@twilio-paste/utils";
78
import * as React from "react";
89
import { useHotkeys } from "react-hotkeys-hook";
910

1011
import { SiteSearch } from "../../site-search";
1112

1213
const SiteHeaderSearch: React.FC = () => {
1314
const [isOpen, setIsOpen] = React.useState(false);
15+
const { breakpointIndex } = useWindowSize();
1416

1517
const onOpen = (): void => {
1618
setIsOpen(true);
@@ -35,7 +37,8 @@ const SiteHeaderSearch: React.FC = () => {
3537
paddingTop="space20"
3638
borderStyle="solid"
3739
boxShadow="shadowBorder"
38-
minWidth="200px"
40+
minWidth={breakpointIndex === 0 ? "150px" : "200px"}
41+
minHeight="36px"
3942
color="colorTextIcon"
4043
variant="reset"
4144
size="reset"
@@ -59,11 +62,15 @@ const SiteHeaderSearch: React.FC = () => {
5962
Search
6063
</Text>
6164
</Box>
62-
<Box as="span" aria-hidden="true">
63-
<InlineCode></InlineCode>
64-
<InlineCode>K</InlineCode>
65-
</Box>
66-
<ScreenReaderOnly>Keyboard shortcut: Command / Control K</ScreenReaderOnly>
65+
{breakpointIndex === 0 ? null : (
66+
<>
67+
<Box as="span" aria-hidden="true">
68+
<InlineCode></InlineCode>
69+
<InlineCode>K</InlineCode>
70+
</Box>
71+
<ScreenReaderOnly>Keyboard shortcut: Command / Control K</ScreenReaderOnly>
72+
</>
73+
)}
6774
</Box>
6875
</Button>
6976
<SiteSearch isOpen={isOpen} onDismiss={onClose} />

0 commit comments

Comments
 (0)