mirror of
https://github.com/flarum/framework.git
synced 2025-04-30 00:24:04 +08:00
Clean up new post layout
This commit is contained in:
parent
5c98a08e0f
commit
fa265152c7
@ -10,8 +10,6 @@ import Composer from 'flarum/components/Composer';
|
|||||||
import ItemList from 'flarum/utils/ItemList';
|
import ItemList from 'flarum/utils/ItemList';
|
||||||
import listItems from 'flarum/helpers/listItems';
|
import listItems from 'flarum/helpers/listItems';
|
||||||
import Button from 'flarum/components/Button';
|
import Button from 'flarum/components/Button';
|
||||||
import Dropdown from 'flarum/components/Dropdown';
|
|
||||||
import PostControls from 'flarum/utils/PostControls';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `CommentPost` component displays a standard `comment`-typed post. This
|
* The `CommentPost` component displays a standard `comment`-typed post. This
|
||||||
@ -44,8 +42,6 @@ export default class CommentPost extends Post {
|
|||||||
}
|
}
|
||||||
|
|
||||||
content() {
|
content() {
|
||||||
const controls = PostControls.controls(this.props.post, this).toArray();
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
<header className="Post-header"><ul>{listItems(this.headerItems().toArray())}</ul></header>,
|
<header className="Post-header"><ul>{listItems(this.headerItems().toArray())}</ul></header>,
|
||||||
<div className="Post-body">
|
<div className="Post-body">
|
||||||
@ -53,16 +49,6 @@ export default class CommentPost extends Post {
|
|||||||
? <div className="Post-preview" config={this.configPreview.bind(this)}/>
|
? <div className="Post-preview" config={this.configPreview.bind(this)}/>
|
||||||
: m.trust(this.props.post.contentHtml())}
|
: m.trust(this.props.post.contentHtml())}
|
||||||
</div>,
|
</div>,
|
||||||
<aside className="Post-actions"><ul>
|
|
||||||
{controls.length ? Dropdown.component({
|
|
||||||
children: controls,
|
|
||||||
className: 'Post-controls',
|
|
||||||
buttonClassName: 'Button Button--icon Button--flat',
|
|
||||||
menuClassName: 'Dropdown-menu--right',
|
|
||||||
icon: 'ellipsis-h'
|
|
||||||
}) : ''}
|
|
||||||
{listItems(this.actionItems().toArray())}
|
|
||||||
</ul></aside>,
|
|
||||||
<footer className="Post-footer"><ul>{listItems(this.footerItems().toArray())}</ul></footer>
|
<footer className="Post-footer"><ul>{listItems(this.footerItems().toArray())}</ul></footer>
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -198,13 +184,4 @@ export default class CommentPost extends Post {
|
|||||||
footerItems() {
|
footerItems() {
|
||||||
return new ItemList();
|
return new ItemList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Build an item list for the post's actions.
|
|
||||||
*
|
|
||||||
* @return {ItemList}
|
|
||||||
*/
|
|
||||||
actionItems() {
|
|
||||||
return new ItemList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ import Component from 'flarum/Component';
|
|||||||
import SubtreeRetainer from 'flarum/utils/SubtreeRetainer';
|
import SubtreeRetainer from 'flarum/utils/SubtreeRetainer';
|
||||||
import Dropdown from 'flarum/components/Dropdown';
|
import Dropdown from 'flarum/components/Dropdown';
|
||||||
import PostControls from 'flarum/utils/PostControls';
|
import PostControls from 'flarum/utils/PostControls';
|
||||||
|
import listItems from 'flarum/helpers/listItems';
|
||||||
|
import ItemList from 'flarum/utils/ItemList';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `Post` component displays a single post. The basic post template just
|
* The `Post` component displays a single post. The basic post template just
|
||||||
@ -45,9 +47,21 @@ export default class Post extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
|
|
||||||
{this.content()}
|
{this.content()}
|
||||||
|
<aside className="Post-actions">
|
||||||
|
<ul>
|
||||||
|
{listItems(this.actionItems().toArray())}
|
||||||
|
{controls.length ? <li>
|
||||||
|
<Dropdown
|
||||||
|
className="Post-controls"
|
||||||
|
buttonClassName="Button Button--icon Button--flat"
|
||||||
|
menuClassName="Dropdown-menu--right"
|
||||||
|
icon="ellipsis-h">
|
||||||
|
{controls}
|
||||||
|
</Dropdown>
|
||||||
|
</li> : ''}
|
||||||
|
</ul>
|
||||||
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})()}
|
})()}
|
||||||
@ -72,4 +86,13 @@ export default class Post extends Component {
|
|||||||
content() {
|
content() {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build an item list for the post's actions.
|
||||||
|
*
|
||||||
|
* @return {ItemList}
|
||||||
|
*/
|
||||||
|
actionItems() {
|
||||||
|
return new ItemList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,6 @@
|
|||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.Post-controls {
|
|
||||||
float: right;
|
|
||||||
// margin-top: -8px;
|
|
||||||
// margin-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.Post-header {
|
.Post-header {
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
@ -148,6 +143,9 @@
|
|||||||
.Post-header, .Post-header a, .PostUser h3, .PostUser h3 a {
|
.Post-header, .Post-header a, .PostUser h3, .PostUser h3 a {
|
||||||
color: @muted-more-color;
|
color: @muted-more-color;
|
||||||
}
|
}
|
||||||
|
&:not(.revealContent) .Post-header {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
.Post-body, .Post-footer, h3 .Avatar, .PostUser-badges {
|
.Post-body, .Post-footer, h3 .Avatar, .PostUser-badges {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
@ -249,12 +247,16 @@
|
|||||||
}
|
}
|
||||||
.Post-actions {
|
.Post-actions {
|
||||||
float: right;
|
float: right;
|
||||||
margin-top: -3px;
|
margin-top: -10px;
|
||||||
.transition(opacity 0.2s);
|
.transition(opacity 0.2s);
|
||||||
|
|
||||||
|
.EventPost &, .Post--hidden & {
|
||||||
|
margin-top: -27px;
|
||||||
|
}
|
||||||
|
|
||||||
@media @tablet-up {
|
@media @tablet-up {
|
||||||
margin-bottom: -10px;
|
margin-bottom: -15px;
|
||||||
opacity: 0.5;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
> ul {
|
> ul {
|
||||||
@ -262,6 +264,7 @@
|
|||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
margin-left: -5px;
|
margin-left: -5px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.Post:hover & {
|
.Post:hover & {
|
||||||
@ -297,14 +300,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media @phone {
|
@media @phone {
|
||||||
.Post-controls {
|
|
||||||
margin-top: -6px;
|
|
||||||
margin-right: -8px;
|
|
||||||
|
|
||||||
.Dropdown-toggle {
|
|
||||||
opacity: 0.5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.Post-header {
|
.Post-header {
|
||||||
.Avatar {
|
.Avatar {
|
||||||
.Avatar--size(32px);
|
.Avatar--size(32px);
|
||||||
@ -338,14 +333,6 @@
|
|||||||
@media @tablet-up {
|
@media @tablet-up {
|
||||||
.Post {
|
.Post {
|
||||||
padding-left: 20px + @avatar-column-width;
|
padding-left: 20px + @avatar-column-width;
|
||||||
|
|
||||||
// .Post-controls {
|
|
||||||
// opacity: 0.5;
|
|
||||||
// transition: opacity 0.2s;
|
|
||||||
// }
|
|
||||||
// &:hover .Post-controls, .Post-controls.open {
|
|
||||||
// opacity: 1;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
.PostUser-avatar {
|
.PostUser-avatar {
|
||||||
margin-left: -@avatar-column-width;
|
margin-left: -@avatar-column-width;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user