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

load solution with help balloon#52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 1 commit intomasterfromfeature/balloon-load-solution
Nov 10, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletionsweb-app/src/components/Button/index.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,13 +2,15 @@ import * as React from 'react'
import{ButtonasAlifdButton}from'@alifd/next'

interfaceProps{
children:string
style?:React.CSSProperties
children:string|React.ReactNode
disabled?:boolean
type?:'primary'|'secondary'|'normal'
onClick():void
onClick?:()=>void
}

constButton=(props:Props)=>(
<AlifdButtononClick={props.onClick}type={props.type}>
<AlifdButtononClick={props.onClick}type={props.type}disabled={props.disabled}style={props.style}>
{props.children}
</AlifdButton>
)
Expand Down
15 changes: 15 additions & 0 deletionsweb-app/src/components/Icon/index.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
import*asReactfrom'react'
import{IconasAlifdIcon}from'@alifd/next'

interfaceProps{
type:string
role?:string
style?:React.CSSProperties
size?:'xxs'|'xs'|'small'|'medium'|'large'|'xl'|'xxl'|'xxxl'|'inherit'
}

constIcon=(props:Props)=>{
return<AlifdIcontype={props.type}role={props.role}size={props.size}style={props.style}/>
}

exportdefaultIcon
55 changes: 55 additions & 0 deletionsweb-app/src/components/StepHelp/index.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
import*asReactfrom'react'
import{Balloon}from'@alifd/next'
importButtonfrom'../Button'
importIconfrom'../Icon'

conststyles={
iconButton:{
display:'flex',
justifyContent:'center',
alignItems:'center',
width:30,
height:30,
},
balloonTitle:{
marginTop:0,
},
balloonOptions:{
display:'flex',
justifyContent:'center',
},
}

interfaceProps{
onLoadSolution():void
}

constStepHelp=(props:Props)=>{
// TODO: extract or replace load solution
const[loadedSolution,setLoadedSolution]=React.useState()
constonClickHandler=()=>{
if(!loadedSolution){
setLoadedSolution(true)
props.onLoadSolution()
}
}
constpromptLeft=(
<Buttonstyle={styles.iconButton}>
<Icontype="prompt"role="button"/>
</Button>
)
return(
<Balloontrigger={promptLeft}align="l"alignEdgetriggerType="click"style={{width:300}}>
<div>
<h4style={styles.balloonTitle}>Stuck? Need help?</h4>
<divstyle={styles.balloonOptions}>
<Buttontype="secondary"onClick={onClickHandler}disabled={loadedSolution}>
Load Solution
</Button>
</div>
</div>
</Balloon>
)
}

exportdefaultStepHelp
46 changes: 22 additions & 24 deletionsweb-app/src/containers/Tutorial/LevelPage/Level/Step/index.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
import*asReactfrom'react'
import*asTfrom'typings'
importButtonfrom'../../../../../components/Button'
importCheckboxfrom'../../../../../components/Checkbox'
importMarkdownfrom'../../../../../components/Markdown'
importStepHelpfrom'../../../../../components/StepHelp'

interfaceProps{
order:number
Expand All@@ -20,34 +20,32 @@ const styles = {
content:{
margin:0,
},
options:{
display:'flex'as'flex',
flexDirection:'row'as'row',
justifyContent:'flex-end',
alignItems:'center'as'center',
padding:'0.5rem',
},
}

constStep=(props:Props)=>{
// TODO: extract or replace load solution
const[loadedSolution,setLoadedSolution]=React.useState()
constonClickHandler=()=>{
if(!loadedSolution){
setLoadedSolution(true)
props.onLoadSolution()
}
}
constshowLoadSolution=props.status==='ACTIVE'&&!loadedSolution

constshowLoadSolution=props.status==='ACTIVE'
return(
<divstyle={styles.card}>
<div>
<Checkboxstatus={props.status}/>
</div>
<div>
<Markdown>{props.content||''}</Markdown>
</div>
<div>
{showLoadSolution&&(
<Buttontype="normal"onClick={onClickHandler}>
Load Solution
</Button>
)}
<div>
<divstyle={styles.card}>
<div>
<Checkboxstatus={props.status}/>
</div>
<div>
<Markdown>{props.content||''}</Markdown>
</div>
</div>
{showLoadSolution&&(
<divstyle={styles.options}>
<StepHelponLoadSolution={props.onLoadSolution}/>
</div>
)}
</div>
)
}
Expand Down
6 changes: 4 additions & 2 deletionsweb-app/stories/utils/SideBarDecorator.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,10 +2,12 @@ import * as React from 'react'

conststyles={
container:{
position:'relative'as'relative',
left:'25rem',
position:'absolute'as'absolute',
boxSizing:'border-box'as'border-box',
borderLeft:'2px solid black',
borderRight:'2px solid black',
width:'100%',
width:'50rem',
height:window.innerHeight,
},
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp