Skip to content
Snippets Groups Projects
Commit cec265ec authored by Chif Gergő's avatar Chif Gergő
Browse files

Style news header. Make text display multi lines if separated by \n

parent 2b2d01bc
No related branches found
No related tags found
No related merge requests found
...@@ -20,8 +20,9 @@ class AddNewsForm extends Component { ...@@ -20,8 +20,9 @@ class AddNewsForm extends Component {
open={this.state.showModal} open={this.state.showModal}
trigger={ trigger={
<Button <Button
size='big'
onClick={() => { this.setState({ showModal: true }); }} onClick={() => { this.setState({ showModal: true }); }}
>Add news >Hír hozzáadása
</Button> </Button>
} }
> >
......
...@@ -21,7 +21,7 @@ class EditNewsForm extends Component { ...@@ -21,7 +21,7 @@ class EditNewsForm extends Component {
onOpen={this.props.onClick} onOpen={this.props.onClick}
trigger={ trigger={
<Button <Button
floated={this.props.floated} compact
onClick={() => { this.setState({ showModal: true }); }} onClick={() => { this.setState({ showModal: true }); }}
size='mini' size='mini'
> >
......
...@@ -3,4 +3,11 @@ ...@@ -3,4 +3,11 @@
font-size: 0.75em; font-size: 0.75em;
font-style: italic; font-style: italic;
font-family: fantasy; font-family: fantasy;
text-align: justify;
}
.news-text {
font-size: 1.15em;
font-family: Arial, Helvetica, sans-serif;
text-align: justify;
} }
...@@ -20,32 +20,35 @@ class News extends Component { ...@@ -20,32 +20,35 @@ class News extends Component {
<Item key={item.id}> <Item key={item.id}>
<Item.Content> <Item.Content>
<Item.Header <Item.Header
as='h3' style={{ fontSize: '2em', width: '100%' }}
style={{ fontSize: '2em' }}
> >
{item.title} <Grid>
<EditNewsForm <Grid.Column floated='center' width={12}>
floated='right' {item.title}
onClick={() => this.props.setSelectedNews(item)} </Grid.Column>
/> <Grid.Column floated='right' width={4}>
<Button <EditNewsForm
color='red' onClick={() => this.props.setSelectedNews(item)}
size='mini' />
floated='right' <Button
onClick={() => this.props.deleteNews(item)} compact
> color='red'
Delete size='mini'
</Button> onClick={() => this.props.deleteNews(item)}
>
Delete
</Button>
</Grid.Column>
</Grid>
</Item.Header> </Item.Header>
<Item.Description style={{ fontSize: '1.33em' }}> <Item.Description className='news-text' style={{ fontSize: '1.33em' }}>
<pre>{item.text}</pre> {this.renderMultiLine(item.text)}
</Item.Description> </Item.Description>
<Item.Extra> <Item.Extra>
<Grid> <Grid>
<Grid.Row className='news-extra'> <Grid.Row className='news-extra'>
<Grid.Column floated='left' width={10}> <Grid.Column floated='left' width={10}>
<p> Készült: {moment(item.created_at).format('LLLL')} </p> <p> Készült: {moment(item.created_at).format('LLLL')} </p>
{/* TODO get the time when was edited */}
<p> Szerkesztve: {moment(item.updated_at).format('LLLL')}</p> <p> Szerkesztve: {moment(item.updated_at).format('LLLL')}</p>
</Grid.Column> </Grid.Column>
<Grid.Column floated='right' width={5}> <Grid.Column floated='right' width={5}>
...@@ -61,14 +64,19 @@ class News extends Component { ...@@ -61,14 +64,19 @@ class News extends Component {
)); ));
} }
renderMultiLine(text) {
const strings = text.split('\n');
return strings.map(string => <p>{string}</p>);
}
render() { render() {
return ( return (
<div> <div>
<Segment style={{ padding: '3em 3em' }} vertical> <Segment style={{ padding: '3em 3em' }} vertical>
{/* { this.props.user.is_superuser ? <AddNewsForm /> : ''} */} {/* { this.props.user.is_superuser ? <AddNewsForm /> : ''} */}
<AddNewsForm />
<Container text textAlign='center'> <Container text textAlign='center'>
<AddNewsForm />
<Item.Group divided> <Item.Group divided>
{this.renderNews()} {this.renderNews()}
</Item.Group> </Item.Group>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment