diff --git a/src/components/ArticleListContent/index.js b/src/components/ArticleListContent/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c4525d6a51a8e401740387f854200521891c7f46 --- /dev/null +++ b/src/components/ArticleListContent/index.js @@ -0,0 +1,17 @@ +import React from 'react'; +import moment from 'moment'; +import { Avatar } from 'antd'; +import styles from './index.less'; + +const ArticleListContent = ({ data: { content, updatedAt, avatar, owner, href } }) => ( +
+
{content}
+
+ + {owner} 发布在 {href} + {moment(updatedAt).format('YYYY-MM-DD HH:mm')} +
+
+); + +export default ArticleListContent; diff --git a/src/components/ArticleListContent/index.less b/src/components/ArticleListContent/index.less new file mode 100644 index 0000000000000000000000000000000000000000..acf2c919143d4ef858159dcb7470fe7728afb9bc --- /dev/null +++ b/src/components/ArticleListContent/index.less @@ -0,0 +1,38 @@ +@import '~antd/lib/style/themes/default.less'; + +.listContent { + .description { + line-height: 22px; + max-width: 720px; + } + .extra { + color: @text-color-secondary; + margin-top: 16px; + line-height: 22px; + & > :global(.ant-avatar) { + vertical-align: top; + margin-right: 8px; + width: 20px; + height: 20px; + position: relative; + top: 1px; + } + & > em { + color: @disabled-color; + font-style: normal; + margin-left: 16px; + } + } +} + +@media screen and (max-width: @screen-xs) { + .listContent { + .extra { + & > em { + display: block; + margin-left: 0; + margin-top: 8px; + } + } + } +} diff --git a/src/pages/Account/Center/Articles.js b/src/pages/Account/Center/Articles.js index dcdaf873a5432b962cab4516cd2da81a76cb3a7d..9bb5ac309ef1180b5ed7bf53c32720545dc6386a 100644 --- a/src/pages/Account/Center/Articles.js +++ b/src/pages/Account/Center/Articles.js @@ -1,8 +1,7 @@ import React, { PureComponent } from 'react'; -import { List, Icon, Avatar, Tag } from 'antd'; -import moment from 'moment'; +import { List, Icon, Tag } from 'antd'; import { connect } from 'dva'; -import stylesArticles from '../../List/Articles.less'; +import ArticleListContent from '@/components/ArticleListContent'; import styles from './Articles.less'; @connect(({ list }) => ({ @@ -19,16 +18,6 @@ class Center extends PureComponent { {text} ); - const ListContent = ({ data: { content, updatedAt, avatar, owner, href } }) => ( -
-
{content}
-
- - {owner} 发布在 {href} - {moment(updatedAt).format('YYYY-MM-DD HH:mm')} -
-
- ); return ( + {item.title} } @@ -59,7 +48,7 @@ class Center extends PureComponent { } /> - + )} /> diff --git a/src/pages/Account/Center/Articles.less b/src/pages/Account/Center/Articles.less index 36cdd0c32d1ac12b899bfcc7341bf53fcc5853bc..2e51509ba7debe11d9da0981b633d3ffe4b90d20 100644 --- a/src/pages/Account/Center/Articles.less +++ b/src/pages/Account/Center/Articles.less @@ -1,3 +1,5 @@ +@import '~antd/lib/style/themes/default.less'; + .articleList { :global { .ant-list-item:first-child { @@ -5,3 +7,6 @@ } } } +a.listItemMetaTitle { + color: @heading-color; +} diff --git a/src/pages/List/Articles.js b/src/pages/List/Articles.js index 4d7cd0111a81dd970536b9e204232261012a8b54..5df46d5fc11f7d7ba0c67b7cdc40a901a24a1d34 100644 --- a/src/pages/List/Articles.js +++ b/src/pages/List/Articles.js @@ -1,10 +1,10 @@ import React, { Component, Fragment } from 'react'; -import moment from 'moment'; import { connect } from 'dva'; -import { Form, Card, Select, List, Tag, Icon, Avatar, Row, Col, Button } from 'antd'; +import { Form, Card, Select, List, Tag, Icon, Row, Col, Button } from 'antd'; import TagSelect from '@/components/TagSelect'; import StandardFormRow from '@/components/StandardFormRow'; +import ArticleListContent from '@/components/ArticleListContent'; import styles from './Articles.less'; const { Option } = Select; @@ -96,18 +96,6 @@ class SearchList extends Component { ); - const ListContent = ({ data: { content, updatedAt, avatar, owner, href } }) => ( -
-
{content}
-
- - {owner} 发布在 - {href} - {moment(updatedAt).format('YYYY-MM-DD HH:mm')} -
-
- ); - const formItemLayout = { wrapperCol: { xs: { span: 24 }, @@ -186,10 +174,7 @@ class SearchList extends Component { {getFieldDecorator('user', {})( - )} @@ -198,10 +183,7 @@ class SearchList extends Component { {getFieldDecorator('rate', {})( - )} @@ -247,7 +229,7 @@ class SearchList extends Component { } /> - + )} /> diff --git a/src/pages/List/Articles.less b/src/pages/List/Articles.less index 3f2db2b2f9be8062b34ba99009d5b1aed29ac43a..3ec950159ad2904b50e9ecd3208e3b369fe5daee 100644 --- a/src/pages/List/Articles.less +++ b/src/pages/List/Articles.less @@ -1,30 +1,5 @@ @import '~antd/lib/style/themes/default.less'; -@import '~@/utils/utils.less'; -.listContent { - .description { - line-height: 22px; - max-width: 720px; - } - .extra { - color: @text-color-secondary; - margin-top: 16px; - line-height: 22px; - & > :global(.ant-avatar) { - vertical-align: top; - margin-right: 8px; - width: 20px; - height: 20px; - position: relative; - top: 1px; - } - & > em { - color: @disabled-color; - font-style: normal; - margin-left: 16px; - } - } -} a.listItemMetaTitle { color: @heading-color; } @@ -41,15 +16,6 @@ a.listItemMetaTitle { display: block; margin-left: 0; } - .listContent { - .extra { - & > em { - display: block; - margin-left: 0; - margin-top: 8px; - } - } - } } @media screen and (max-width: @screen-md) { .selfTrigger {