Skip to content

Commit 1e192ce

Browse files
Merge pull request #17 from Typext/bugfix/adjusts-header-style
Bugfix/adjusts header style
2 parents 0ff4d9f + 2159f3f commit 1e192ce

File tree

43 files changed

+916
-108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+916
-108
lines changed

src/App.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import React from 'react';
22

3-
import Header from './components/Header/Header';
43
import Routes from './routes';
54
import GlobalStyle from './styles/global';
65

76
function App() {
87
return (
98
<>
10-
<Header />
119
<Routes />
1210
<GlobalStyle />
1311
</>

src/DTOs/User.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export interface IUser {
2+
name: string;
3+
username: string;
4+
email: string;
5+
}

src/DTOs/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './User';
2+
export * from './Minute';

src/assets/logo.svg

Lines changed: 5 additions & 0 deletions
Loading

src/assets/workInProgress.svg

Lines changed: 1 addition & 0 deletions
Loading

src/components/Header/Header.tsx renamed to src/components/Header/index.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import { useHistory } from 'react-router-dom';
23

34
import addIcon from '../../assets/add_icon.svg';
45
import homeIcon from '../../assets/home_icon.svg';
@@ -8,10 +9,19 @@ import logoutIcon from '../../assets/logout_icon.svg';
89
import { StyledHeader } from './styles';
910

1011
const Header = () => {
12+
const history = useHistory();
13+
14+
const handleNavigateToHome = () => {
15+
history.push('/');
16+
};
17+
1118
return (
1219
<StyledHeader>
1320
<section className="shortOptions">
14-
<img src={homeIcon} alt="" />
21+
<button type="button" onClick={handleNavigateToHome}>
22+
<img src={homeIcon} alt="" />
23+
</button>
24+
1525
<img src={addIcon} alt="" />
1626
</section>
1727

src/components/Header/styles.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,15 @@ export const StyledHeader = styled.header`
3333
width: 14.375rem;
3434
}
3535
}
36+
37+
button {
38+
border: none;
39+
background: none;
40+
}
41+
42+
.shortOptions {
43+
max-width: 150px;
44+
width: 100%;
45+
justify-content: flex-start;
46+
}
3647
`;

src/components/Route/index.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React from 'react';
2+
3+
import Header from 'components/Header';
4+
5+
import { Route as ReactRoute } from 'react-router-dom';
6+
7+
interface RouteProps {
8+
component: Function;
9+
path: string;
10+
exact?: boolean;
11+
isPrivate?: boolean;
12+
}
13+
14+
const Route = ({ component: Component, isPrivate, ...rest }: RouteProps) => {
15+
return (
16+
<ReactRoute
17+
{...rest}
18+
render={() => {
19+
return (
20+
<>
21+
{isPrivate && <Header />}
22+
<Component />
23+
</>
24+
);
25+
}}
26+
/>
27+
);
28+
};
29+
30+
Route.defaultProps = {
31+
exact: false,
32+
isPrivate: false,
33+
};
34+
35+
export default Route;

src/components/Select/Select.tsx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import React, { SelectHTMLAttributes } from 'react';
2+
import { StyledSelect } from './styles';
3+
4+
interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
5+
title: string;
6+
color?: string;
7+
Size?: string;
8+
styleWidth?: string;
9+
}
10+
11+
const Select: React.FC<SelectProps> = ({
12+
title,
13+
id,
14+
color,
15+
Size,
16+
styleWidth,
17+
...rest
18+
}: SelectProps) => {
19+
return (
20+
<StyledSelect
21+
SelectWidth={styleWidth || '23.75rem'}
22+
Color={color || 'var(--black)'}
23+
Size={Size || '1.5rem'}
24+
>
25+
<h3>{title}</h3>
26+
27+
<select name={title} id={id} {...rest} />
28+
29+
</StyledSelect>
30+
);
31+
};
32+
33+
Select.defaultProps = {
34+
Size: '',
35+
styleWidth: '23.75rem',
36+
color: '',
37+
};
38+
39+
export default Select;

0 commit comments

Comments
 (0)