Skip to content

Commit

Permalink
Users should be presented with a reset password link
Browse files Browse the repository at this point in the history
  • Loading branch information
Jadowacu1 committed Jul 4, 2024
1 parent ff1539f commit 43c5e36
Show file tree
Hide file tree
Showing 16 changed files with 360 additions and 27 deletions.
12 changes: 9 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
"airbnb-typescript",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jsx-a11y/recommended",
"plugin:storybook/recommended"
],
"ignorePatterns":["jest.config.ts"],
"ignorePatterns": ["jest.config.ts"],
"rules": {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
Expand Down Expand Up @@ -58,7 +59,12 @@
"no-param-reassign": "off",
"arrow-body-style": ["warn", "as-needed"],
"jsx-a11y/no-static-element-interactions": "off",
"max-len": "off"
"max-len": "off",
"jsx-a11y/label-has-associated-control": ["error", {
"required": {
"some": ["nesting", "id"]
}
}]
},
"settings": {
"react": {
Expand All @@ -72,4 +78,4 @@
}
}
}
}
}
53 changes: 49 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"build-storybook": "storybook build"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.5.2",
"@fortawesome/free-solid-svg-icons": "^6.5.2",
"@fortawesome/react-fontawesome": "^0.2.2",
"@reduxjs/toolkit": "^2.2.5",
"axios": "^1.7.2",
"html-webpack-plugin": "^5.6.0",
Expand Down
1 change: 1 addition & 0 deletions src/App.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import '../src/styles/reset-password.scss'
3 changes: 2 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import AppRouter from './router';
import './App.scss';

const App: React.FC = () => (
<Router>
<AppRouter />
</Router>
);

export default App;
export default App;
2 changes: 1 addition & 1 deletion src/components/layout/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ const Footer: React.FC = () => (
</footer>
);

export default Footer;
export default Footer;
2 changes: 1 addition & 1 deletion src/components/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ const Header: React.FC = () => (
</header>
);

export default Header;
export default Header;
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ root.render(
<Provider store={store}>
<App />
</Provider>
);
);
1 change: 0 additions & 1 deletion src/pages/LandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { loadWelcomeMessage } from '../store/features/welcomeSlice';
import { IWelcomeMessage } from '../utils/types/store';
import Header from '../components/layout/Header';
import Footer from '../components/layout/Footer';
import '../styles/LandingPage.scss';

const LandingPage: React.FC = () => {
const dispatch = useAppDispatch();
Expand Down
2 changes: 1 addition & 1 deletion src/pages/NotFound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ const NotFound: React.FC = () => (
</main>
);

export default NotFound;
export default NotFound;
68 changes: 68 additions & 0 deletions src/pages/ResetPassword.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import React, { useState } from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faEye, faEyeSlash } from '@fortawesome/free-solid-svg-icons';
import Button from '../components/buttons/Button';
import Header from '../components/layout/Header';

const ResetPassword: React.FC = () => {
const [showNewPassword, setShowNewPassword] = useState(false);
const [showConfirmPassword, setShowConfirmPassword] = useState(false);

const newPasswordVisibility = () => {
setShowNewPassword(!showNewPassword);
};

const confirmPasswordVisibility = () => {
setShowConfirmPassword(!showConfirmPassword);
};

return (
<main>
<Header />
<form className="resetPasswordForm">
<h1>Reset password</h1>
<div className="input-containers">
<div className="input-container1">
<input
type={showNewPassword ? 'text' : 'password'}
className="input-field1"
placeholder=" "
id="newPassword"
required
/>
<label className="input-label1" htmlFor="newPassword">New password</label>
<button
type="button"
className="toggle-password"
onClick={newPasswordVisibility}
>
<FontAwesomeIcon icon={showNewPassword ? faEyeSlash : faEye} />
</button>
</div>
<div className="input-container2">
<input
type={showConfirmPassword ? 'text' : 'password'}
className="input-field2"
placeholder=" "
id="confirmPassword"
required
/>
<label className="input-label2" htmlFor="confirmPassword">Confirm password</label>
<button
type="button"
className="toggle-password"
onClick={confirmPasswordVisibility}
>
<FontAwesomeIcon icon={showConfirmPassword ? faEyeSlash : faEye} />
</button>
</div>
<div className="reset-Button">
<Button title="Reset Password" />
</div>
</div>
</form>
</main>
);
};

export default ResetPassword;
26 changes: 26 additions & 0 deletions src/pages/SendResetPasswordLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import Header from '../components/layout/Header';
import Button from '../components/buttons/Button';

const SendResetPasswordLink:React.FC = () => (
<>
<Header />
<main>
<div className="resetPassword-Container">
<h1>Get Reset Password Link</h1>

<div className="input-container">
<input type="email" className="input-field" placeholder=" " id="email" required />
<label className="input-label" htmlFor="email">Email Address</label>
</div>

<div className="reset-Button">
<Button title="Get Reset Link" />
</div>

</div>
</main>
</>
);

export default SendResetPasswordLink;
7 changes: 5 additions & 2 deletions src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@ import { Route, Routes } from 'react-router-dom';
import LandingPage from './pages/LandingPage';
import Login from './pages/Login';
import NotFound from './pages/NotFound';
import SendResetPasswordLink from './pages/SendResetPasswordLink';
import ResetPassword from './pages/ResetPassword';

const AppRouter: React.FC = () => {
return (
<div>
<Routes>
<Route path="/" element={<LandingPage />} />
<Route path="/login" element={<Login />} />
<Route path="/send-reset-password-link" element={<SendResetPasswordLink />} />
<Route path="/reset-password" element={<ResetPassword />} />
<Route path="*" element={<NotFound />} />
</Routes>
</div>
);
};

export default AppRouter;
export default AppRouter;
12 changes: 0 additions & 12 deletions src/styles/LandingPage.scss

This file was deleted.

4 changes: 4 additions & 0 deletions src/styles/colors.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$primary-color: #FF6D18;
$button-bg-color: #FF6D18;
$button-text-color: #fff;
$text-color: #000000;
Loading

0 comments on commit 43c5e36

Please sign in to comment.