Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

50 showroom | top bar #54

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>

</html>
4 changes: 4 additions & 0 deletions src/common/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ export const PAGES_PATHS = {
SIGN_UP: '/signup',
HOME: '/',
RESET_PASS: '/reset-password',
SEARCH: '/search',
FAVOURITES: '/favourites',
}

export const ButtonLables = {
Expand All @@ -17,3 +19,5 @@ export const HttpMethods = {
PUT: 'put',
DELETE: 'delete',
}

export const AUTH_PAGES = [PAGES_PATHS.LOG_IN, PAGES_PATHS.SIGN_UP, PAGES_PATHS.RESET_PASS]
3 changes: 3 additions & 0 deletions src/features/top-bar/assets/favourites-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/features/top-bar/assets/user-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions src/features/top-bar/components/top-bar/top-bar.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
.topBar {
width: 100vw;
display: flex;
flex-direction: column;

&Elements {
max-width: 1100px;
width: 100%;
margin: 22px auto;
display: flex;
}

&Element {
margin: auto 15px;
font-weight: 600;
font-size: 14px;
color: var(--gray-500);
}

&InputCategoryHolder {
background: transparent !important;
padding: 0 !important;
}

&InputCategory {
border: 0 !important;
}

&Search {
width: 688px;
}

&Link {
display: flex;
text-decoration: none;
}

&Link:hover {
span {
color: var(--primary-300) !important;
}
svg path {
fill: var(--primary-300) !important;
}
}

&LinkIcon {
margin: auto 6px;
}

&LinkText {
color: var(--gray-600);
font-size: 14px;
margin: auto;
}

&Divider {
margin: 0;
width: 100%;
height: 1px;
border: 1px solid var(--gray-200);
}
}
78 changes: 78 additions & 0 deletions src/features/top-bar/components/top-bar/top-bar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { Dropdown } from 'primereact/dropdown'
import { Link, useNavigate } from 'react-router-dom'
import classNames from 'classnames'
import { useState } from 'react'

import { AUTH_PAGES, PAGES_PATHS } from 'common/constants/constants'
import { InputText } from 'primereact/inputtext'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sa grupam importurile din node_modules si custom imports si sa lasam un spatiu intre ele.

import { useStore } from 'store/store'

import { ReactComponent as AssistLogo } from 'common/assets/logo-assist.svg'
import { ReactComponent as UserIcon } from './../../assets/user-icon.svg'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sa folosim mereu absolute paths.

import { ReactComponent as FavIcon } from './../../assets/favourites-icon.svg'

import style from './top-bar.module.scss'

export const TopBar = () => {
const [selectCategory, setSelectedCategory] = useState(null)

const { authStore } = useStore()
const { userName } = authStore

const navigate = useNavigate()

const categories = [{ name: 'Category 1' }, { name: 'Category 2' }, { name: 'Category 3' }]

const onCityChange = (e: any) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Un type pentru event, te rog

setSelectedCategory(e.value)
}

const handleKeyDown = (event: any) => {
if (event.key === 'Enter') {
navigate(`${PAGES_PATHS.SEARCH}/${event.target.value}`)
}
}

if (AUTH_PAGES.includes(document.location.pathname)) return <></>

return (
<section className={style.topBar}>
<div className={style.topBarElements}>
<div className={style.topBarElement}>
<Link to={PAGES_PATHS.HOME}>
<AssistLogo />
</Link>
</div>
<div className={style.topBarSearch}>
<div className='p-inputgroup'>
<span className={classNames('p-inputgroup-addon', style.topBarInputCategoryHolder)}>
<Dropdown
className={style.topBarInputCategory}
value={selectCategory}
options={categories}
onChange={onCityChange}
optionLabel='name'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pune constante, te rog

placeholder='Category'
/>
</span>
<InputText onKeyDown={handleKeyDown} />
</div>
</div>
<div className={style.topBarElement}>
<Link to={PAGES_PATHS.FAVOURITES} className={style.topBarLink}>
<FavIcon className={style.topBarLinkIcon} />
<span className={style.topBarLinkText}>Favourites</span>
</Link>
</div>
<div className={style.topBarElement}>
{/**replace the link to PAGES_PATHS.settings when the PR will be merged */}
<Link to={'/setting/profile'} className={style.topBarLink}>
<UserIcon className={style.topBarLinkIcon} />
<span className={style.topBarLinkText}>{userName || 'My account'}</span>
</Link>
</div>
</div>
<hr className={style.topBarDivider} />
</section>
)
}
8 changes: 3 additions & 5 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
'Droid Sans', 'Helvetica Neue', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
}
2 changes: 2 additions & 0 deletions src/pages/page-router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { BrowserRouter, Route, Routes } from 'react-router-dom'
import { AuthPage } from './page-auth/page-auth'
import { PAGES_PATHS } from '../common/constants/constants'
import { PageAllComponents } from './page-all-components'
import { TopBar } from 'features/top-bar/components/top-bar/top-bar'

export const PageRouter = () => {
return (
<BrowserRouter>
<TopBar />
<Routes>
<Route path={PAGES_PATHS.HOME} element={<PageAllComponents />}></Route>
<Route path={PAGES_PATHS.LOG_IN} element={<AuthPage type='login' />} />
Expand Down