Skip to content

Commit 1c425fc

Browse files
committed
backup
1 parent e3a6cfe commit 1c425fc

File tree

5 files changed

+60
-8
lines changed

5 files changed

+60
-8
lines changed

src/App.test.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import React from 'react';
2-
import { render, screen } from '@testing-library/react';
2+
33
import App from './App';
44

55
test('renders learn react link', () => {
6-
render(<App />);
7-
const linkElement = screen.getByText(/learn react/i);
8-
expect(linkElement).toBeInTheDocument();
6+
7+
98
});

src/example/ExampleInner.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { memo, useState } from "react"
2+
import styled from "styled-components"
3+
import { Button, Space } from "antd"
4+
import { ShellContainer } from "./ShellContainer"
5+
import { WorkflowEditor } from "../workflow-editor/WorkflowEditor"
6+
7+
const Toolbar = styled.div`
8+
height: 80px;
9+
border-bottom: solid 1px ${props => props.theme.token?.colorBorder};
10+
display: flex;
11+
align-items: center;
12+
padding: 8px;
13+
`
14+
15+
export const ExampleInner = memo((
16+
props: {
17+
toggleTheme: () => void
18+
}
19+
) => {
20+
const { toggleTheme } = props
21+
const [inputValue, setInputValue] = useState<any>()
22+
23+
24+
return (
25+
26+
<ShellContainer>
27+
<Toolbar>
28+
<Space>
29+
<Button onClick={toggleTheme}>主题切换</Button>
30+
</Space>
31+
</Toolbar>
32+
<WorkflowEditor />
33+
</ShellContainer>
34+
)
35+
})

src/example/ShellContainer.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const Container = styled.div`
1111
background-color: ${props => props.theme.token?.colorBgBase};
1212
`
1313

14-
1514
export const ShellContainer = memo((
1615
props: {
1716
children?: React.ReactNode

src/example/index.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1-
import { memo, useState } from "react"
1+
import { ConfigProvider, theme } from "antd"
2+
import { memo, useCallback, useState } from "react"
3+
import { ExampleInner } from "./ExampleInner"
24

35
export const Example = memo(() => {
46
const [themeMode, setThemeMode] = useState<"dark" | "light">("light")
7+
8+
const handleToggleTheme = useCallback(() => {
9+
setThemeMode(mode => mode === "light" ? "dark" : "light")
10+
}, [])
11+
512
return (
6-
<>haha
7-
</>
13+
<ConfigProvider
14+
theme={{
15+
algorithm: themeMode === "dark" ? theme.darkAlgorithm : theme.defaultAlgorithm
16+
}}
17+
>
18+
<ExampleInner toggleTheme={handleToggleTheme} />
19+
</ConfigProvider>
820
)
921
})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { memo } from "react"
2+
3+
export const WorkflowEditor = memo(() => {
4+
return (
5+
<></>
6+
)
7+
})

0 commit comments

Comments
 (0)