Skip to content

Commit 57ad7ae

Browse files
feat: add guest banner
1 parent b66fd32 commit 57ad7ae

13 files changed

+137
-13
lines changed

package-lock.json

+21-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
"eslint-plugin-prettier": "4.0.0",
5555
"eslint-plugin-react": "7.28.0",
5656
"postcss": "8.4.7",
57-
"prettier": "2.5.1",
57+
"prettier": "^2.5.1",
58+
"prettier-plugin-tailwindcss": "^0.1.8",
5859
"tailwindcss": "3.0.23"
5960
}
6061
}

src/App.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import { FC } from 'react';
22
import Provider from './context/Context';
33
import AppRoutes from './AppRoutes';
4+
import { Header } from './components';
45

56
const App: FC = () => {
67
return (
78
<Provider>
8-
<AppRoutes />
9+
<Header />
10+
<div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
11+
<AppRoutes />
12+
</div>
913
</Provider>
1014
);
1115
};

src/AppRoutes.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { FC } from 'react';
2-
import { BrowserRouter, Route, Routes } from 'react-router-dom';
3-
import { Wall } from './pages';
2+
import { Route, Routes } from 'react-router-dom';
3+
import { SignUpIn, Wall } from './pages';
44

55
const AppRoutes: FC = () => (
6-
<BrowserRouter>
7-
<Routes>
8-
<Route path="/" element={<Wall />} />
9-
</Routes>
10-
</BrowserRouter>
6+
<Routes>
7+
<Route path="/" element={<Wall />} />
8+
<Route path="/sign-up" element={<SignUpIn />} />
9+
<Route path="/sign-in" element={<SignUpIn />} />
10+
</Routes>
1111
);
1212

1313
export default AppRoutes;

src/components/button/Button.tsx

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { FC } from 'react';
2+
3+
interface Props {
4+
onClick?: () => void;
5+
title: string;
6+
type: 'outlined' | 'primary' | 'secondary' | 'white';
7+
}
8+
9+
const Button: FC<Props> = ({ onClick, title, type }) => {
10+
const style = {
11+
outlined: {
12+
class:
13+
'border border-white bg-primary text-white hover:bg-white hover:text-primary'
14+
},
15+
white: {
16+
class: 'bg-white text-primary'
17+
},
18+
primary: {
19+
class: 'bg-primary text-white'
20+
},
21+
secondary: {
22+
class: 'bg-secondary text-white'
23+
}
24+
};
25+
26+
return (
27+
<button
28+
onClick={onClick}
29+
className={`
30+
text-md ml-6 inline-flex items-center rounded-md bg-opacity-90
31+
px-4 py-2 font-medium hover:bg-opacity-100 ${style[type].class}`}>
32+
{title}
33+
</button>
34+
);
35+
};
36+
37+
export default Button;

src/components/header/GuestBanner.tsx

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { FC } from 'react';
2+
import { Link } from 'react-router-dom';
3+
import { Button } from '..';
4+
5+
const GuestBanner: FC = () => {
6+
return (
7+
<div className="flex w-full items-center justify-between">
8+
<span className="hidden text-xl font-light text-white md:block">
9+
Don’ t miss the chance to interact with us!
10+
</span>
11+
<div className="flex w-full justify-around md:w-auto">
12+
<Link to="/sign-in">
13+
<Button title="Sign in" type="outlined" />
14+
</Link>
15+
<Link to="/sign-up">
16+
<Button title="Sign up" type="white" />
17+
</Link>
18+
</div>
19+
</div>
20+
);
21+
};
22+
23+
export default GuestBanner;

src/components/header/Header.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { FC } from 'react';
2+
import GuestBanner from './GuestBanner';
3+
4+
const Header: FC = () => {
5+
return (
6+
<header className="bg-primary">
7+
<div className="mx-auto flex h-16 max-w-7xl px-4 sm:px-6 lg:px-8">
8+
<GuestBanner />
9+
</div>
10+
</header>
11+
);
12+
};
13+
14+
export default Header;

src/components/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default as Button } from './button/Button';
2+
export { default as Header } from './header/Header';

src/index.css

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
@tailwind base;
22
@tailwind components;
33
@tailwind utilities;
4+
5+
@layer base {
6+
body {
7+
background-color: #f3f4f6;
8+
font-family: Roboto, sans-serif;
9+
}
10+
}

src/index.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3+
import { BrowserRouter } from 'react-router-dom';
34
import './index.css';
45
import App from './App';
56
import reportWebVitals from './reportWebVitals';
67

78
ReactDOM.render(
89
<React.StrictMode>
9-
<App />
10+
<BrowserRouter>
11+
<App />
12+
</BrowserRouter>
1013
</React.StrictMode>,
1114
document.getElementById('root')
1215
);

src/pages/SignUpIn.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { FC } from 'react';
2+
3+
const SignUpIn: FC = () => {
4+
return <div>SignUpIn</div>;
5+
};
6+
7+
export default SignUpIn;

src/pages/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export { default as Wall } from './Wall';
2+
export { default as SignUpIn } from './SignUpIn';

tailwind.config.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
module.exports = {
22
content: ['./src/**/*.{ts,tsx}'],
33
theme: {
4-
extend: {}
4+
extend: {
5+
colors: {
6+
primary: '#7D49AA',
7+
secondary: '#F3C677'
8+
}
9+
}
510
},
611
plugins: []
7-
};
12+
};

0 commit comments

Comments
 (0)