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
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit621fa98

Browse files
committed
[core] rename Drawer to Preview
Drawer is kind of conflict with Doraomon in search
1 parenta2d2478 commit621fa98

File tree

18 files changed

+110
-109
lines changed

18 files changed

+110
-109
lines changed

‎containers/Body/index.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ const AppHeader = () => {
4747
<SearchonClick={logic.openDoraemon}>
4848
<SearchIcon/>
4949
</Search>
50-
<NotificationonClick={logic.openDrawer}>
50+
<NotificationonClick={logic.openPreview}>
5151
<NotificationIcon/>
5252
</Notification>
53-
<UseronClick={logic.openDrawer.bind(this,'user')}>
53+
<UseronClick={logic.openPreview.bind(this,'user')}>
5454
<UserIcon/>
5555
</User>
5656
</Header>

‎containers/Body/logic.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const debug = makeDebugger('L:Body')
55

66
letstore=null
77

8-
exportfunctionopenDrawer(type){
9-
store.openDrawer(type)
8+
exportfunctionopenPreview(type){
9+
store.openPreview(type)
1010
}
1111

1212
exportfunctionchangeTheme(name){

‎containers/Drawer/index.js‎

Lines changed: 0 additions & 63 deletions
This file was deleted.

‎containers/IntroBody/logic.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const debug = makeDebugger('L:IntroBody')
55

66
letstore=null
77

8-
exportfunctionopenDrawer(){
9-
store.openDrawer()
8+
exportfunctionopenPreview(){
9+
store.openPreview()
1010
}
1111

1212
exportfunctionchangeTheme(name){

‎containers/Preview/index.js‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
*
3+
* Preview
4+
*
5+
*/
6+
7+
importReactfrom'react'
8+
import{inject,observer}from'mobx-react'
9+
10+
// import Link from 'next/link'
11+
12+
import{makeDebugger}from'../../utils/functions'
13+
import*aslogicfrom'./logic'
14+
import{
15+
PreviewOverlay,
16+
PreviewWrapper,
17+
PreviewCloser,
18+
PreviewContent,
19+
PreviewHeader,
20+
PreviewBody,
21+
Closer,
22+
CloserInner,
23+
}from'./styles'
24+
25+
constdebug=makeDebugger('C:Preview')
26+
27+
constCloseBtn=({ type})=>(
28+
<PreviewCloseronClick={logic.closePreview}>
29+
<Closertype={type}>
30+
<CloserInner/>
31+
</Closer>
32+
</PreviewCloser>
33+
)
34+
35+
constselector=({ store})=>({
36+
store:store.preview,
37+
})
38+
39+
classPreviewContainerextendsReact.Component{
40+
componentWillMount(){
41+
debug('mount')
42+
logic.init(this.props.store)
43+
}
44+
45+
render(){
46+
const{ visible, type}=this.props.store
47+
// debug('visiblei: ', visible)
48+
return(
49+
<div>
50+
<PreviewOverlayvisible={visible}onClick={logic.closePreview}/>
51+
<PreviewWrappervisible={visible}type={type}>
52+
<CloseBtntype={type}/>
53+
<PreviewContent>
54+
<PreviewHeader>Preview header</PreviewHeader>
55+
<PreviewBody>Preview body</PreviewBody>
56+
</PreviewContent>
57+
</PreviewWrapper>
58+
</div>
59+
)
60+
}
61+
}
62+
63+
exportdefaultinject(selector)(observer(PreviewContainer))
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import{makeDebugger}from'../../utils/functions'
22

3-
constdebug=makeDebugger('L:Drawer')
3+
constdebug=makeDebugger('L:Preview')
44

55
letstore=null
66

77
exportfunctioninit(selectedStore){
88
store=selectedStore
99
}
1010

11-
exportfunctioncloseDrawer(){
12-
debug('closeDrawer')
11+
exportfunctionclosePreview(){
12+
debug('closePreview')
1313
store.close()
1414
}

‎containers/Drawer/styles/index.js‎renamed to ‎containers/Preview/styles/index.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function doTransform(visible) {
66
returnvisible ?'translate(0px, 0px)' :'translate(105%, 0px)'
77
}
88

9-
exportconstDrawerOverlay=styled.div`
9+
exportconstPreviewOverlay=styled.div`
1010
bottom: 0;
1111
left: 0;
1212
overflow: auto;
@@ -22,7 +22,7 @@ export const DrawerOverlay = styled.div`
2222
// display: ${props => (props.visible ? 'block' : 'none')};
2323
// visibility: ${props => (props.visible ? 'visible' : 'hidden')};
2424

25-
exportconstDrawerWrapper=styled.div`
25+
exportconstPreviewWrapper=styled.div`
2626
color:${theme('drawer.font')};
2727
box-sizing: border-box;
2828
transition: transform 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms;
@@ -40,24 +40,24 @@ export const DrawerWrapper = styled.div`
4040
display: flex;
4141
justify-content: flex-end;
4242
`
43-
exportconstDrawerContent=styled.div`
43+
exportconstPreviewContent=styled.div`
4444
width: 90%;
4545
background-color:${theme('drawer.bg')};
4646
height: 100%;
4747
box-shadow: -5px 0px 14px 0px rgba(189, 189, 189, 0.37);
4848
padding: 20px;
4949
`
50-
exportconstDrawerHeader=styled.div`
50+
exportconstPreviewHeader=styled.div`
5151
border-bottom: 1px solid tomato;
5252
text-align: center;
5353
line-height: 30px;
5454
`
55-
exportconstDrawerBody=styled.div`
55+
exportconstPreviewBody=styled.div`
5656
text-align: center;
5757
margin-top: 20%;
5858
`
5959

60-
exportconstDrawerCloser=styled.div`width: 10%;`
60+
exportconstPreviewCloser=styled.div`width: 10%;`
6161

6262
constcloseWith='40px'
6363

‎containers/Drawer/tests/index.test.js‎renamed to ‎containers/Preview/tests/index.test.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// import React from 'react'
22
// import { shallow } from 'enzyme'
33

4-
// importDrawer from '../index'
4+
// importPreview from '../index'
55

6-
describe('<Drawer />',()=>{
6+
describe('<Preview />',()=>{
77
it('Expect to have unit tests specified',()=>{
88
expect(true).toEqual(true)
99
})

‎docs/ideas.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
##TODO
3333

34+
-[ ] rename Drawer -> Preview
3435
-[ ] use header section footer main ... html tags
3536
-[ ][字体问题参考](http://element.eleme.io/2.0/#/zh-CN/component/typography)
3637
-[ ][字体](https://github.com/ethantw/Han)

‎pages/index.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import MultiLanguage from '../containers/MultiLanguage'
99
importSidebarfrom'../containers/Sidebar'
1010
importBodyfrom'../containers/Body'
1111

12-
importDrawerfrom'../containers/Drawer'
12+
importPreviewfrom'../containers/Preview'
1313
importDoraemonfrom'../containers/Doraemon'
1414

1515
// try to fix safari bug
@@ -46,7 +46,7 @@ export default class Index extends React.Component {
4646
<Providerstore={this.store}>
4747
<Decrator>
4848
<MultiLanguage>
49-
<Drawer/>
49+
<Preview/>
5050
<Bodyroute={route}/>
5151
<Sidebarroute={route}/>
5252
<Doraemon/>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp