Skip to content

Commit

Permalink
remove: Paper and #15 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Deturium committed Nov 16, 2018
1 parent c5060bc commit 2d590e4
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 110 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ package-lock.json

# env
.env/
src/pages/Topic/index.tsx
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"emotion": "^9.2.12",
"lodash-es": "^4.17.11",
"prop-types": "^15.6.2",
"react": "^16.7.0-alpha.0",
"react-dom": "16.7.0-alpha.0",
"react": "^16.7.0-alpha.2",
"react-dom": "16.7.0-alpha.2",
"react-emotion": "^9.2.12",
"react-swipeable-views": "^0.13.0",
"react-swipeable-views-utils": "^0.13.0",
Expand Down
9 changes: 2 additions & 7 deletions src/pages/Board/BoardHead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
ExpansionPanel,
ExpansionPanelDetails,
ExpansionPanelSummary,
Paper,
} from '@material-ui/core'

import ExpandMoreIcon from '@material-ui/icons/ExpandMore'
Expand All @@ -28,9 +27,6 @@ interface Props {
const styles: StyleRules = {
root: {
width: '100%',
boxShadow: '0 0 0 0',
borderTop: '#eaeaea solid thin',
borderBottom: '#eaeaea solid thin',
},
expanded: {
marginTop: '0.5rem',
Expand Down Expand Up @@ -82,7 +78,6 @@ const boardMasters = css`
display: flex;
width: 100%;
padding-left: 1.5rem;
border-bottom: #eaeaea solid thin;
`
const toolButton = css`
margin-right: 1rem;
Expand Down Expand Up @@ -114,7 +109,7 @@ export default withStyles(styles)((props: Props) => {
}

return (
<Paper className={boardHeader}>
<div className={boardHeader}>
<div className={boardMessage}>
<Button color="primary" className={boardTitle}>
{data.name}
Expand Down Expand Up @@ -165,6 +160,6 @@ export default withStyles(styles)((props: Props) => {
</Button>
))}
</div>
</Paper>
</div>
)
})
6 changes: 3 additions & 3 deletions src/pages/Board/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useState, useEffect } from 'react'
import { css } from 'emotion'
import { navigate } from '@reach/router'

import { FormControl, MenuItem, Paper, Select } from '@material-ui/core'
import { FormControl, MenuItem, Select } from '@material-ui/core'

import { Theme, withStyles } from '@material-ui/core/styles'
import { StyleRulesCallback, ClassNameMap } from '@material-ui/core/styles/withStyles'
Expand Down Expand Up @@ -100,7 +100,7 @@ export default withStyles(styles)((props: Props) => {
}

return (
<Paper className={boardStyle}>
<div className={boardStyle}>
{board && <BoardHead data={board} />}
<>
{tags.length > 0 ? (
Expand Down Expand Up @@ -149,6 +149,6 @@ export default withStyles(styles)((props: Props) => {
</>

<TopicList key={`${tag1.id}-${tag2.id}`} id={id} tags={[tag1, tag2]} />
</Paper>
</div>
)
})
29 changes: 13 additions & 16 deletions src/pages/Message/Detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import InfiniteList from '@/components/InfiniteList'
import store, { Detail } from '@/pages/Message/model/detail'

import { List, RootRef } from '@material-ui/core'
import Paper from '@material-ui/core/Paper'

import DetailItem from './components/DetailItem'

Expand Down Expand Up @@ -38,21 +37,19 @@ export default ({ id }: Props) => {
<Subscribe to={[store]}>
{({ state: { messages, isEnd, isLoading } }: Detail) => (
<>
<Paper>
<RootRef rootRef={list}>
<List>
<InfiniteList
loadingPosition="top"
isEnd={isEnd[id]}
isLoading={isLoading}
callback={store.getList}
>
{messages[id] &&
messages[id]!.map(item => <DetailItem key={item.id} message={item} />)}
</InfiniteList>
</List>
</RootRef>
</Paper>
<RootRef rootRef={list}>
<List>
<InfiniteList
loadingPosition="top"
isEnd={isEnd[id]}
isLoading={isLoading}
callback={store.getList}
>
{messages[id] &&
messages[id]!.map(item => <DetailItem key={item.id} message={item} />)}
</InfiniteList>
</List>
</RootRef>
<Editor sendCallBack={store.sendMessage} />
</>
)}
Expand Down
22 changes: 8 additions & 14 deletions src/pages/Message/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Subscribe } from '@cc98/state'
import InfiniteList from '@/components/InfiniteList'
import MessageStore from '@/pages/Message/model/recent'

import { List, Paper } from '@material-ui/core'
import { List } from '@material-ui/core'

import ListItem from './components/ListItem'

Expand All @@ -19,19 +19,13 @@ import ListItem from './components/ListItem'
export default () => (
<Subscribe to={[MessageStore]}>
{({ state: { recentList, recentListEnd, recentListLoading }, getRecentList }: MessageStore) => (
<Paper>
<List>
<InfiniteList
isEnd={recentListEnd}
isLoading={recentListLoading}
callback={getRecentList}
>
{recentList.map(item => (
<ListItem key={item.userId} message={item} />
))}
</InfiniteList>
</List>
</Paper>
<List>
<InfiniteList isEnd={recentListEnd} isLoading={recentListLoading} callback={getRecentList}>
{recentList.map(item => (
<ListItem key={item.userId} message={item} />
))}
</InfiniteList>
</List>
)}
</Subscribe>
)
60 changes: 26 additions & 34 deletions src/pages/MyFollow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ import { css } from 'emotion'
import TopicItem from '@/components/TopicItem'
import InfiniteList from '@/components/InfiniteList'

import { List, Paper, Tab, Tabs } from '@material-ui/core'
import { List, Tab, Tabs } from '@material-ui/core'

import { Theme, withStyles } from '@material-ui/core/styles'
import { ClassNameMap } from '@material-ui/core/styles/withStyles'
import { getFollowBoardsTopics, getFollowUsersTopics } from '@/services/topic'
import { ITopic } from '@cc98/api'
import { getBoardNameById } from '@/services/board'

interface Props {
classes: ClassNameMap
}
interface State {
isLoading: boolean
isEnd: boolean
Expand All @@ -30,14 +25,7 @@ const indexStyle = css`
}
`

const styles = (theme: Theme) => ({
root: {
color: theme.palette.primary.main,
},
})

export default withStyles(styles)((props: Props) => {
const { classes } = props
export default () => {
const [state, setState] = useState<State>({
isLoading: false,
isEnd: false,
Expand Down Expand Up @@ -112,25 +100,29 @@ export default withStyles(styles)((props: Props) => {
const topics = current === 'board' ? b_topics : u_topics

return (
<div>
<Paper className={indexStyle}>
<Tabs fullWidth value={current} onChange={changeFocus}>
<Tab classes={{ root: classes.root }} value="board" label="关注版面" />
<Tab classes={{ root: classes.root }} value="user" label="关注用户" />
</Tabs>

<InfiniteList
isLoading={isLoading}
isEnd={isEnd}
callback={current === 'board' ? getFollowBTopics : getFolloweeTopics}
>
<List>
{topics.map(topic => (
<TopicItem key={topic.id} data={topic} place={'follow'} />
))}
</List>
</InfiniteList>
</Paper>
<div className={indexStyle}>
<Tabs
textColor="primary"
indicatorColor="primary"
fullWidth
value={current}
onChange={changeFocus}
>
<Tab value="board" label="关注版面" />
<Tab value="user" label="关注用户" />
</Tabs>

<InfiniteList
isLoading={isLoading}
isEnd={isEnd}
callback={current === 'board' ? getFollowBTopics : getFolloweeTopics}
>
<List>
{topics.map(topic => (
<TopicItem key={topic.id} data={topic} place={'follow'} />
))}
</List>
</InfiniteList>
</div>
)
})
}
18 changes: 8 additions & 10 deletions src/pages/NewTopic/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'

import InfiniteList from '@/components/InfiniteList'

import { List, Paper } from '@material-ui/core'
import { List } from '@material-ui/core'

import TopicItem from '@/components/TopicItem'

Expand Down Expand Up @@ -53,14 +53,12 @@ export default () => {
}

return (
<Paper>
<InfiniteList isLoading={isLoading} isEnd={isEnd} callback={callback}>
<List>
{topics.map((info: ITopic) => (
<TopicItem key={info.id} data={info} place={'newtopic'} />
))}
</List>
</InfiniteList>
</Paper>
<InfiniteList isLoading={isLoading} isEnd={isEnd} callback={callback}>
<List>
{topics.map((info: ITopic) => (
<TopicItem key={info.id} data={info} place={'newtopic'} />
))}
</List>
</InfiniteList>
)
}
30 changes: 14 additions & 16 deletions src/pages/Search/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react'
import { css } from 'react-emotion'

import { TextField, Button, List, Paper } from '@material-ui/core'
import { TextField, Button, List } from '@material-ui/core'

import { searchTopics } from '@/services/topic'
import { ITopic } from '@cc98/api'
Expand Down Expand Up @@ -74,21 +74,19 @@ export default () => {
搜索
</Button>
{view && (
<Paper>
<InfiniteList
isLoading={isLoading}
isEnd={isEnd}
callback={() => {
search()
}}
>
<List>
{topics.map(info => (
<TopicItem key={info.id} data={info} place={'search'} />
))}
</List>
</InfiniteList>
</Paper>
<InfiniteList
isLoading={isLoading}
isEnd={isEnd}
callback={() => {
search()
}}
>
<List>
{topics.map(info => (
<TopicItem key={info.id} data={info} place={'search'} />
))}
</List>
</InfiniteList>
)}
</div>
)
Expand Down
2 changes: 0 additions & 2 deletions src/pages/Topic/PostItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { IPost, IUser } from '@cc98/api'
const root = css`
margin-top: 6px;
background-color: #ccc;
border-bottom: #eaeaea solid thick;
`

const expand = css`
Expand Down Expand Up @@ -113,7 +112,6 @@ const styles: StyleRules = {
height: '30px',
fontSize: '0.8rem',
opacity: 0.54,
borderTop: '#aaaaaa solid thin',
marginLeft: '16px',
marginRight: '16px',
},
Expand Down
1 change: 0 additions & 1 deletion src/pages/UserCenter/Topics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const styles: StyleRules = {
itemRoot: {
paddingTop: 3,
paddingBottom: 3,
borderTop: '#eaeaea solid thin',
},
bigAvatar: {
width: '5rem',
Expand Down
6 changes: 2 additions & 4 deletions src/pages/UserCenter/User.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
List,
ListItem,
ListItemText,
Paper,
} from '@material-ui/core'
import { StyleRules, withStyles } from '@material-ui/core/styles'
import { ClassNameMap } from '@material-ui/core/styles/withStyles'
Expand All @@ -34,7 +33,6 @@ const styles: StyleRules = {
itemRoot: {
paddingTop: 3,
paddingBottom: 3,
borderTop: '#eaeaea solid thin',
},
bigAvatar: {
width: '5rem',
Expand Down Expand Up @@ -170,7 +168,7 @@ export default withStyles(styles)((props: Props) => {
)
if (info) {
return (
<Paper className={userStyle}>
<div className={userStyle}>
<CardHeader
className={classes.row}
classes={{ action: classes.action }}
Expand Down Expand Up @@ -325,7 +323,7 @@ export default withStyles(styles)((props: Props) => {
</List>

<Topics info={info} />
</Paper>
</div>
)
}

Expand Down

0 comments on commit 2d590e4

Please sign in to comment.