Skip to content

Commit

Permalink
update site
Browse files Browse the repository at this point in the history
  • Loading branch information
MrWangJustToDo committed Dec 28, 2023
1 parent a0e4942 commit 3a19226
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 9 deletions.
2 changes: 2 additions & 0 deletions ui/ssr-example/src/client/component/Header/GlobalStyle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const GlobalStyle = () => {
padding: 3px 5px;
}
.hljs {
--hljs-color: #383a42;
color: #383a42;
background: #fafafa;
}
Expand Down Expand Up @@ -87,6 +88,7 @@ export const GlobalStyle = () => {
padding: 3px 5px;
}
.hljs {
--hljs-color: #e9e9f4;
color: #e9e9f4;
background: #282936;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export const ScrollControlTool = ({
cursor="pointer"
borderRadius="full"
sx={{
backgroundColor: currentSection === i ? "red" : "initial",
border: currentSection === i ? "none" : "1px solid #e2e2e2",
backgroundColor: currentSection === i ? "purple.600" : "initial",
border: currentSection === i ? "none" : "1.5px solid #e2e2e2",
}}
onClick={() => clickHandler(i)}
/>
Expand Down
2 changes: 1 addition & 1 deletion ui/ssr-example/src/client/container/Section/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const MainSection = () => {
This website is built with <Tag>@my-react</Tag> project. <br /> Version: @my-react/react [{reactVersion}]; @my-react/react-dom [{reactDOMVersion}]
(enableMockReact: <Checkbox isChecked={enableMockReact.current} readOnly />)
</Text>
<HStack marginTop="14" spacing="4" display={{ base: "none", md: "flex" }} fontSize={{ md: "12px", lg: "14px", xl: "16px" }}>
<HStack marginTop="14" spacing="3" display={{ base: "none", md: "flex" }} fontSize={{ md: "12px", lg: "13px", xl: "14px" }}>
<Button
variant="solid"
fontSize="inherit"
Expand Down
19 changes: 17 additions & 2 deletions ui/ssr-example/src/client/container/Section/Next.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { Box, Button, Container, Flex, HStack, Heading, Icon, Spacer, Tag, Text, Tooltip, useColorModeValue } from "@chakra-ui/react";
import { useEffect, useRef } from "react";
import { HiChevronDoubleRight } from "react-icons/hi";
import { useLocation } from "react-router";

import { Section } from "@client/component";
import { Card } from "@client/component/Card";
import { NextPlayground } from "@client/component/NextPlayground";
import { CONTAINER_WIDTH } from "@client/config/container";
import { useIsMounted } from "@client/hooks";
import { mark } from "@client/utils/markdown";

// const Iframe = chakra("iframe");
Expand Down Expand Up @@ -49,6 +52,18 @@ const renderBody = mark.render(shellMd);
export const NextSection = () => {
const bgColor = useColorModeValue("gray.300", "gray.600");

const { hash } = useLocation();

const isMounted = useIsMounted();

const ref = useRef<HTMLDivElement>();

useEffect(() => {
if (isMounted && hash && hash === "#next-section") {
ref.current.scrollIntoView({ behavior: "smooth", block: "center" });
}
}, [hash, isMounted]);

return (
<Container maxWidth={CONTAINER_WIDTH} minHeight="100vh" marginTop="4%">
<Flex justifyContent="center" flexDirection={{ base: "column", md: "row" }} marginX={{ base: "2", md: "6%", lg: "8%", xl: "10%", "2xl": "12%" }}>
Expand Down Expand Up @@ -115,8 +130,8 @@ export const NextSection = () => {
/>
</Section>
</Flex>
<Card overflow="hidden" marginX={{ base: "2", md: "6%", lg: "8%", xl: "10%", "2xl": "12%" }}>
<Flex padding="1" fontFamily="monospace" alignItems="center">
<Card ref={ref} overflow="hidden" marginX={{ base: "2", md: "6%", lg: "8%", xl: "10%", "2xl": "12%" }}>
<Flex padding="1" fontFamily="monospace" alignItems="center" as="a" href="#next-section">
<Icon as={HiChevronDoubleRight}></Icon>
<Text marginLeft={2}>NextJS + @my-react</Text>
</Flex>
Expand Down
19 changes: 17 additions & 2 deletions ui/ssr-example/src/client/container/Section/Vite.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { Box, Button, Container, Flex, Heading, Icon, Spacer, Tag, Text, Tooltip, useColorModeValue } from "@chakra-ui/react";
import { useEffect, useRef } from "react";
import { HiChevronDoubleRight } from "react-icons/hi";
import { useLocation } from "react-router";

import { Section } from "@client/component";
import { Card } from "@client/component/Card";
import { VitePlayground } from "@client/component/VitePlayground";
import { CONTAINER_WIDTH } from "@client/config/container";
import { useIsMounted } from "@client/hooks";
import { mark } from "@client/utils/markdown";

const shellMd = `
Expand Down Expand Up @@ -34,6 +37,18 @@ const renderBody = mark.render(shellMd);
export const ViteSection = () => {
const bgColor = useColorModeValue("gray.300", "gray.600");

const { hash } = useLocation();

const ref = useRef<HTMLDivElement>();

const isMounted = useIsMounted();

useEffect(() => {
if (isMounted && hash && hash === "#vite-section") {
ref.current.scrollIntoView({ behavior: "smooth", block: "center" });
}
}, [hash, isMounted]);

return (
<Container maxWidth={CONTAINER_WIDTH} minHeight="100vh" marginTop="4%">
<Flex justifyContent="center" flexDirection={{ base: "column", md: "row" }} marginX={{ base: "2", md: "6%", lg: "8%", xl: "10%", "2xl": "12%" }}>
Expand Down Expand Up @@ -80,8 +95,8 @@ export const ViteSection = () => {
/>
</Section>
</Flex>
<Card overflow="hidden" marginX={{ base: "2", md: "6%", lg: "8%", xl: "10%", "2xl": "12%" }}>
<Flex padding="1" fontFamily="monospace" alignItems="center">
<Card ref={ref} overflow="hidden" marginX={{ base: "2", md: "6%", lg: "8%", xl: "10%", "2xl": "12%" }}>
<Flex padding="1" fontFamily="monospace" alignItems="center" as="a" href="#vite-section">
<Icon as={HiChevronDoubleRight}></Icon>
<Text marginLeft={2}>Vite + @my-react</Text>
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion ui/ssr-example/src/client/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const ApiSection = __REACT__ && !__STREAM__ ? _ApiSection : lazy(() => import("@

const Page = () => {
return (
<Box fontFamily='fantasy'>
<Box fontFamily="sans-serif">
<ScrollControl initialSectionLength={4}>
<ScrollContent>
<ScrollSection>
Expand Down
2 changes: 1 addition & 1 deletion ui/ssr-example/src/client/styles/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,6 @@ blockquote {
}

.code-num {
color: initial;
color: var(--hljs-color);
font-style: initial;
}

0 comments on commit 3a19226

Please sign in to comment.