Skip to content

Commit d89ad56

Browse files
committed
Create listing page and stepper component
1 parent f616e79 commit d89ad56

File tree

8 files changed

+116
-2
lines changed

8 files changed

+116
-2
lines changed

client/src/Components/Navbar/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ class C extends React.Component<RouteComponentProps<{}>, State> {
6363
</Row>
6464

6565
<Row>
66+
<NavLink
67+
invertColors={isHomePage}
68+
onClick={() => push('/createListing')}
69+
>
70+
Zostan gospodarzem
71+
</NavLink>
6672
<NavLink
6773
invertColors={isHomePage}
6874
onClick={() => push('/listings')}

client/src/Components/Navbar/style.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const Svg = styled.svg<InvertColors>`
3131
export const NavLink = styled.p<InvertColors>`
3232
margin: 0 20px 0 20px;
3333
font-size: 14px;
34-
font-weight: 600;
35-
color: ${p => (p.invertColors ? 'white' : '#494a55')};
34+
font-weight: 500;
35+
color: ${p => (p.invertColors ? 'white' : '#484848')};
3636
cursor: pointer;
3737
`
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import * as React from 'react'
2+
3+
import { StepperWrapper, StepperFill } from './style'
4+
5+
interface Props {
6+
currentStep: number
7+
maxSteps: number
8+
}
9+
10+
export const Stepper: React.SFC<Props> = ({ currentStep, maxSteps }) => (
11+
<StepperWrapper>
12+
<StepperFill currentStep={currentStep} maxSteps={maxSteps} />
13+
</StepperWrapper>
14+
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import styled from 'styled-components'
2+
3+
interface Stepper {
4+
currentStep: number
5+
maxSteps: number
6+
}
7+
8+
export const StepperWrapper = styled.div`
9+
width: 100%;
10+
height: 10px;
11+
background-color: #eceeed;
12+
`
13+
export const StepperFill = styled.div<Stepper>`
14+
width: ${p => (p.currentStep * 100) / p.maxSteps}%;
15+
height: 10px;
16+
border-top-right-radius: 25px;
17+
border-bottom-right-radius: 25px;
18+
background-color: #00a597;
19+
transition: width 200ms ease;
20+
`
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import * as React from 'react'
2+
3+
import { Container, Wrapper, White, Gray } from './style'
4+
import { Stepper } from '../../../../Components/Stepper'
5+
6+
interface State {
7+
step: number
8+
}
9+
10+
export class Form extends React.Component<{}, State> {
11+
public readonly state = {
12+
step: 1
13+
}
14+
15+
public render() {
16+
return (
17+
<>
18+
<Stepper currentStep={this.state.step} maxSteps={2} />
19+
<Container>
20+
<White />
21+
<Gray />
22+
<Wrapper>
23+
<p
24+
onClick={() =>
25+
this.setState(({ step }) => ({
26+
step: step + 1
27+
}))
28+
}
29+
>
30+
lol
31+
</p>
32+
</Wrapper>
33+
</Container>
34+
</>
35+
)
36+
}
37+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import styled from 'styled-components'
2+
3+
export const Container = styled.div`
4+
width: 100%;
5+
height: calc(100vh - 90px);
6+
display: flex;
7+
justify-content: center;
8+
align-items: center;
9+
`
10+
11+
export const White = styled.div`
12+
width: 65%;
13+
height: calc(100vh - 90px);
14+
position: fixed;
15+
left: 0;
16+
background-color: white;
17+
`
18+
export const Gray = styled.div`
19+
width: 35%;
20+
height: calc(100vh - 90px);
21+
position: fixed;
22+
right: 0;
23+
background-color: #fafafa;
24+
`
25+
export const Wrapper = styled.div`
26+
width: 550px;
27+
height: 650px;
28+
background-color: red;
29+
z-index: 200;
30+
`
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import * as React from 'react'
2+
3+
import { Form } from './Components/Form'
4+
5+
export const CreateListing: React.SFC<{}> = () => <Form />

client/src/Routes/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Navbar } from '../Components/Navbar'
55
import { Home } from '../Pages/Home'
66
import { Listings } from '../Pages/Listings'
77
import { Listing } from '../Pages/Listing'
8+
import { CreateListing } from '../Pages/CreateListing'
89

910
export const Routes: React.SFC<{}> = () => (
1011
<BrowserRouter>
@@ -15,6 +16,7 @@ export const Routes: React.SFC<{}> = () => (
1516
<Navbar />
1617
<Route path="/listings" component={Listings} />
1718
<Route path="/listing/:id" component={Listing} />
19+
<Route path="/createListing" component={CreateListing} />
1820
</>
1921
</Route>
2022
</Switch>

0 commit comments

Comments
 (0)