File tree Expand file tree Collapse file tree 5 files changed +60
-8
lines changed
workflow-editor/WorkflowEditor Expand file tree Collapse file tree 5 files changed +60
-8
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import { render , screen } from '@testing-library/react' ;
2
+
3
3
import App from './App' ;
4
4
5
5
test ( 'renders learn react link' , ( ) => {
6
- render ( < App /> ) ;
7
- const linkElement = screen . getByText ( / l e a r n r e a c t / i) ;
8
- expect ( linkElement ) . toBeInTheDocument ( ) ;
6
+
7
+
9
8
} ) ;
Original file line number Diff line number Diff line change
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
+ } )
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ const Container = styled.div`
11
11
background-color: ${ props => props . theme . token ?. colorBgBase } ;
12
12
`
13
13
14
-
15
14
export const ShellContainer = memo ( (
16
15
props : {
17
16
children ?: React . ReactNode
Original file line number Diff line number Diff line change 1
- import { memo , useState } from "react"
1
+ import { ConfigProvider , theme } from "antd"
2
+ import { memo , useCallback , useState } from "react"
3
+ import { ExampleInner } from "./ExampleInner"
2
4
3
5
export const Example = memo ( ( ) => {
4
6
const [ themeMode , setThemeMode ] = useState < "dark" | "light" > ( "light" )
7
+
8
+ const handleToggleTheme = useCallback ( ( ) => {
9
+ setThemeMode ( mode => mode === "light" ? "dark" : "light" )
10
+ } , [ ] )
11
+
5
12
return (
6
- < > haha
7
- </ >
13
+ < ConfigProvider
14
+ theme = { {
15
+ algorithm : themeMode === "dark" ? theme . darkAlgorithm : theme . defaultAlgorithm
16
+ } }
17
+ >
18
+ < ExampleInner toggleTheme = { handleToggleTheme } />
19
+ </ ConfigProvider >
8
20
)
9
21
} )
Original file line number Diff line number Diff line change
1
+ import { memo } from "react"
2
+
3
+ export const WorkflowEditor = memo ( ( ) => {
4
+ return (
5
+ < > </ >
6
+ )
7
+ } )
You can’t perform that action at this time.
0 commit comments