Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit58453b8

Browse files
committed
refactor out reusable lib components
1 parentdebb808 commit58453b8

File tree

11 files changed

+59
-25
lines changed

11 files changed

+59
-25
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import*asReactfrom'react'
2+
import{ButtonasAlifdButton}from'@alifd/next'
3+
4+
interfaceProps{
5+
children:string
6+
type?:'primary'|'secondary'|'normal'
7+
onClick():void
8+
}
9+
10+
constButton=(props:Props)=>(
11+
<AlifdButtononClick={props.onClick}type={props.type}>
12+
{props.children}
13+
</AlifdButton>
14+
)
15+
16+
exportdefaultButton

‎web-app/src/components/Card/index.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import*asReactfrom'react'
2+
import{CardasAlifdCard}from'@alifd/next'
3+
4+
interfaceProps{
5+
children:React.ReactNode
6+
onClick?:()=>void
7+
style?:React.CSSProperties
8+
}
9+
10+
constCard=(props:Props)=>(
11+
<AlifdCardshowTitleBullet={false}contentHeight="auto"onClick={props.onClick}style={props.style}>
12+
{props.children}
13+
</AlifdCard>
14+
)
15+
16+
exportdefaultCard

‎web-app/src/containers/Continue/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import*asReactfrom'react'
2-
import{Button,Card}from'@alifd/next'
2+
importButtonfrom'../../components/Button'
3+
importCardfrom'../../components/Card'
34
import*asCRfrom'typings'
45
import*asGfrom'typings/graphql'
56

@@ -12,14 +13,14 @@ interface Props {
1213
exportconstContinuePage=(props:Props)=>(
1314
<div>
1415
<h3>Continue</h3>
15-
<CardshowTitleBullet={false}contentHeight="auto">
16+
<Card>
1617
<div>
1718
<h2>{props.tutorial.version.summary.title}</h2>
1819
<p>{props.tutorial.version.summary.description}</p>
1920
<ButtononClick={props.onContinue}>Resume</Button>
2021
</div>
2122
</Card>
22-
<CardshowTitleBullet={false}contentHeight="auto">
23+
<Card>
2324
<div>
2425
<h2>Start a New Tutorial</h2>
2526
<ButtononClick={props.onNew}>Select New Tutorial</Button>

‎web-app/src/containers/New/TutorialItem.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import*asReactfrom'react'
2-
import{Button,Card}from'@alifd/next'
2+
importButtonfrom'../../components/Button'
3+
importCardfrom'../../components/Card'
34

45
interfaceProps{
56
title:string
@@ -9,7 +10,7 @@ interface Props {
910

1011
constTutorialItem=(props:Props)=>{
1112
return(
12-
<CardshowTitleBullet={false}contentHeight="auto">
13+
<Card>
1314
<div>
1415
<h2>{props.title}</h2>
1516
<p>{props.description}</p>

‎web-app/src/containers/New/TutorialList/TutorialItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import*asReactfrom'react'
2-
import{Card}from'@alifd/next'
2+
importCardfrom'../../../components/Card'
33

44
conststyles={
55
card:{

‎web-app/src/containers/New/TutorialList/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import*asReactfrom'react'
2-
3-
importchannelfrom'../../../services/channel'
42
import*asGfrom'typings/graphql'
3+
54
importTutorialItemfrom'./TutorialItem'
5+
importchannelfrom'../../../services/channel'
66

77
interfaceProps{
88
tutorialList:G.Tutorial[]

‎web-app/src/containers/Overview/OverviewPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import*asReactfrom'react'
2-
import{Button}from'@alifd/next'
2+
importButtonfrom'../../components/Button'
33
import*asGfrom'typings/graphql'
44

55
importMarkdownfrom'../../components/Markdown'
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import*asReactfrom'react'
2-
import{Button}from'@alifd/next'
2+
importButtonfrom'../../components/Button'
33
import*asCRfrom'typings'
44

55
conststyles={
@@ -9,22 +9,22 @@ const styles = {
99
}
1010

1111
interfaceProps{
12-
context:CR.MachineContext
13-
send(action:CR.Action|string):void
12+
context:CR.MachineContext
13+
send(action:CR.Action|string):void
1414
}
1515

1616
constCompletedPage=(props:Props)=>{
17-
constselectNewTutorial=()=>{
18-
props.send('SELECT_TUTORIAL')
19-
}
17+
constselectNewTutorial=()=>{
18+
props.send('SELECT_TUTORIAL')
19+
}
2020
return(
21-
<div>
22-
<h3>Tutorial Complete</h3>
23-
<divstyle={styles.options}>
24-
<ButtononClick={selectNewTutorial}>Continue</Button>
25-
</div>
26-
</div>
27-
)
21+
<div>
22+
<h3>Tutorial Complete</h3>
23+
<divstyle={styles.options}>
24+
<ButtononClick={selectNewTutorial}>Continue</Button>
25+
</div>
26+
</div>
27+
)
2828
}
2929

3030
exportdefaultCompletedPage

‎web-app/src/containers/Tutorial/LevelPage/Level/Step/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import*asReactfrom'react'
22
import*asTfrom'typings'
3-
import{Button}from'@alifd/next'
3+
importButtonfrom'../../../../../components/Button'
44
importCheckboxfrom'../../../../../components/Checkbox'
55
importMarkdownfrom'../../../../../components/Markdown'
66

‎web-app/src/containers/Tutorial/LevelPage/Level/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import{Button}from'@alifd/next'
21
import*asReactfrom'react'
32
import*asGfrom'typings/graphql'
43
import*asTfrom'typings'
54

65
importStepfrom'./Step'
6+
importButtonfrom'../../../../components/Button'
77
importMarkdownfrom'../../../../components/Markdown'
88

99
conststyles={

‎web-app/src/services/state/actions/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as G from 'typings/graphql'
33
importclientfrom'../../apollo'
44
importauthenticateMutationfrom'../../apollo/mutations/authenticate'
55
import{setAuthToken}from'../../apollo/auth'
6-
importchannelfrom'../../../services/channel'
6+
importchannelfrom'../../channel'
77

88
interfaceAuthenticateData{
99
editorLogin:{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp