-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Cintia Sanchez Garcia <[email protected]>
- Loading branch information
1 parent
3836b3f
commit 63348f0
Showing
12 changed files
with
361 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,7 @@ select:focus { | |
a, | ||
.btn-link { | ||
text-decoration: none; | ||
color: inherit; | ||
} | ||
|
||
@media (hover: hover) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
.title { | ||
font-size: 0.8rem; | ||
min-width: 0; | ||
background-color: var(--bs-gray-300); | ||
} | ||
|
||
.card { | ||
height: 237px; | ||
font-size: 90%; | ||
cursor: pointer; | ||
} | ||
|
||
.card :global(.badge) { | ||
font-size: 65%; | ||
} | ||
|
||
.card :global(.accepted-date) { | ||
display: flex !important; | ||
.title { | ||
font-size: 0.8rem; | ||
min-width: 0; | ||
} | ||
|
||
.card { | ||
height: 237px; | ||
font-size: 90%; | ||
cursor: pointer; | ||
} | ||
|
||
.card :global(.badge) { | ||
font-size: 65%; | ||
} | ||
|
||
.card :global(.accepted-date) { | ||
display: flex !important; | ||
} | ||
|
||
.card:hover { | ||
border-color: var(--bs-primary) !important; | ||
box-shadow: 0px 0px 5px 0px var(--bs-focus-ring-color); | ||
} | ||
} | ||
|
||
.card:hover { | ||
border-color: var(--bs-primary) !important; | ||
box-shadow: 0px 0px 5px 0px var(--bs-focus-ring-color); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { orderBy } from 'lodash'; | ||
import { useNavigate, useOutletContext } from 'react-router-dom'; | ||
import { Waypoint } from 'react-waypoint'; | ||
|
||
import { BaseItem, Item, OutletContext } from '../../../types'; | ||
import { CategoriesData } from '../../../utils/prepareData'; | ||
import { convertStringSpaces, Menu } from '.'; | ||
import Card from './Card'; | ||
import styles from './Content.module.css'; | ||
|
||
interface Props { | ||
menu: Menu; | ||
data: CategoriesData; | ||
isVisible: boolean; | ||
} | ||
const Content = (props: Props) => { | ||
const navigate = useNavigate(); | ||
const { updateActiveItemId } = useOutletContext() as OutletContext; | ||
|
||
const sortItems = (firstCategory: string, firstSubcategory: string): BaseItem[] => { | ||
return orderBy( | ||
props.data[firstCategory][firstSubcategory].items, | ||
[(item: BaseItem) => item.name.toString()], | ||
'asc' | ||
); | ||
}; | ||
|
||
const handleEnter = (id: string) => { | ||
if (`#${id}` !== location.hash) { | ||
navigate( | ||
{ ...location, hash: id }, | ||
{ | ||
replace: true, | ||
} | ||
); | ||
} | ||
}; | ||
|
||
return ( | ||
<> | ||
{Object.keys(props.menu).map((cat: string) => { | ||
return ( | ||
<div key={`list_cat_${cat}`}> | ||
{props.menu[cat].map((subcat: string) => { | ||
const id = convertStringSpaces(`${cat}/${subcat}`); | ||
return ( | ||
<Waypoint | ||
key={`list_subcat_${subcat}`} | ||
topOffset="3%" | ||
bottomOffset="97%" | ||
onEnter={() => handleEnter(id)} | ||
fireOnRapidScroll={false} | ||
> | ||
<div> | ||
<div id={id} className={`fw-semibold p-2 mb-3 text-truncate w-100 ${styles.title}`}> | ||
{cat} / {subcat} | ||
</div> | ||
<div className="row g-4 mb-4"> | ||
{sortItems(cat, subcat).map((item: Item) => { | ||
return ( | ||
<div key={`card_${item.id}`} className="col-12 col-lg-6 col-xxl-4 col-xxxl-3"> | ||
<div | ||
className={`card rounded-0 p-3 ${styles.card}`} | ||
onClick={() => updateActiveItemId(item.id)} | ||
> | ||
<Card item={item} className="h-100" /> | ||
</div> | ||
</div> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
</Waypoint> | ||
); | ||
})} | ||
</div> | ||
); | ||
})} | ||
</> | ||
); | ||
}; | ||
|
||
export default Content; |
Oops, something went wrong.