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

Little changes in Schedule page, add a ScrollRestoration component

parent 0c4e7a22
No related branches found
No related tags found
No related merge requests found
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
"redux": "^4.0.1", "redux": "^4.0.1",
"redux-logger": "^3.0.6", "redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0", "redux-thunk": "^2.3.0",
"semantic-ui-calendar-react": "^0.12.2",
"semantic-ui-css": "^2.4.0", "semantic-ui-css": "^2.4.0",
"semantic-ui-react": "^0.84.0", "semantic-ui-react": "^0.84.0",
"semantic-ui-calendar-react": "^0.12.2",
"slick-carousel": "^1.8.1" "slick-carousel": "^1.8.1"
}, },
"scripts": { "scripts": {
......
import React, { Component } from 'react';
import { withRouter } from 'react-router-dom';
/*
* Default ScrollResoration:
* https://reacttraining.com/react-router/web/guides/scroll-restoration
*/
class ScrollToTop extends Component {
componentDidUpdate(prevProps) {
if (this.props.location !== prevProps.location) {
window.scrollTo(0, 0)
}
}
render() {
return this.props.children;
}
}
export default withRouter(ScrollToTop);
...@@ -32,7 +32,7 @@ class Schedule extends Component { ...@@ -32,7 +32,7 @@ class Schedule extends Component {
> >
<h3> <h3>
<Grid> <Grid>
<Grid.Column floated='left' width={5} textAlign='left'> <Grid.Column floated='left' width={8} textAlign='left'>
<Icon name='angle right' color='blue' />{event.name} <Icon name='angle right' color='blue' />{event.name}
</Grid.Column> </Grid.Column>
<Grid.Column floated='right' width={8} textAlign='right'> <Grid.Column floated='right' width={8} textAlign='right'>
...@@ -42,23 +42,21 @@ class Schedule extends Component { ...@@ -42,23 +42,21 @@ class Schedule extends Component {
</h3> </h3>
</Accordion.Title> </Accordion.Title>
<Accordion.Content active={activeIndex === event.id}> <Accordion.Content active={activeIndex === event.id}>
<Container text textAlign='left'>
<p> <p>
{event.description} {event.description}
</p> </p>
</Container>
</Accordion.Content> </Accordion.Content>
</div> </div>
)); ));
return ( return (
<Container <Container
textAlign='center' textAlign='left'
style={{ style={{
padding: '60px' padding: '60px'
}} }}
> >
<h2>Képzés alkalmak:</h2> <h2>Képzésalkalmak:</h2>
<Accordion <Accordion
fluid fluid
styled styled
...@@ -67,7 +65,6 @@ class Schedule extends Component { ...@@ -67,7 +65,6 @@ class Schedule extends Component {
> >
{panels} {panels}
</Accordion> </Accordion>
<h2>Tábor:</h2>
</Container> </Container>
); );
} }
......
...@@ -5,6 +5,7 @@ import { BrowserRouter as Router } from 'react-router-dom'; ...@@ -5,6 +5,7 @@ import { BrowserRouter as Router } from 'react-router-dom';
import 'slick-carousel/slick/slick.css'; import 'slick-carousel/slick/slick.css';
import 'slick-carousel/slick/slick-theme.css'; import 'slick-carousel/slick/slick-theme.css';
import 'semantic-ui-css/semantic.min.css'; import 'semantic-ui-css/semantic.min.css';
import ScrollToTop from './components/ScrollToTop';
import configureStore from './configureStore'; import configureStore from './configureStore';
import App from './components/App'; import App from './components/App';
...@@ -19,7 +20,9 @@ const store = configureStore(); ...@@ -19,7 +20,9 @@ const store = configureStore();
render( render(
<Provider store={store}> <Provider store={store}>
<Router> <Router>
<App /> <ScrollToTop>
<App />
</ScrollToTop>
</Router> </Router>
</Provider>, </Provider>,
document.getElementById('root'), document.getElementById('root'),
......
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