-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: final steps of places categorization (#379)
* Revert "Revert "feat: places categorization (#368)" (#378)" This reverts commit 192ae9c. * refactor: several components from category * fix: CategoryFilters sort * fix: migration based on base_position * fix: some modal & styles fixes * feat: accept onClick within props * fix: move previous active to manager * fix: compute categories update --------- Co-authored-by: Braian Mellor <braianj@gmail.com> Co-authored-by: lauti7 <lautigbustos@gmail.com>
- Loading branch information
1 parent
15e7153
commit 96fe8bf
Showing
126 changed files
with
13,653 additions
and
1,148 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,10 @@ | ||
import { CategoryAttributes } from "../entities/Category/types" | ||
|
||
export const categories: CategoryAttributes[] = [ | ||
export const categoriesWithPlacesCount = [ | ||
{ | ||
name: "Art", | ||
active: true, | ||
created_at: new Date("2023-04-01T04:53:07.000Z"), | ||
updated_at: new Date("2023-04-01T04:53:07.000Z"), | ||
count: "10", | ||
}, | ||
{ | ||
name: "music", | ||
active: true, | ||
created_at: new Date("2023-04-01T04:53:07.000Z"), | ||
updated_at: new Date("2023-04-01T04:53:07.000Z"), | ||
count: "10", | ||
}, | ||
] |
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
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,15 @@ | ||
.category-buttons__container { | ||
display: flex; | ||
flex-wrap: wrap; | ||
width: 100%; | ||
} | ||
|
||
.category-buttons__container > .category-button { | ||
margin: 0 17px 17px 0; | ||
} | ||
|
||
.category-buttons__container > .dg.Link.ui.button.category-button { | ||
background-color: var(--text-on-primary); | ||
font-weight: normal; | ||
color: var(--text-on-secondary); | ||
} |
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,38 @@ | ||
import React from "react" | ||
|
||
import useFormatMessage from "decentraland-gatsby/dist/hooks/useFormatMessage" | ||
import { Link } from "decentraland-gatsby/dist/plugins/intl" | ||
import TokenList from "decentraland-gatsby/dist/utils/dom/TokenList" | ||
import { Button } from "decentraland-ui/dist/components/Button/Button" | ||
|
||
import { PlaceListOrderBy } from "../../entities/Place/types" | ||
import locations from "../../modules/locations" | ||
|
||
import "./CategoryButtons.css" | ||
|
||
type CategoryButtonsProps = { | ||
categories: string[] | ||
className?: string | ||
} | ||
|
||
export const CategoryButtons = (props: CategoryButtonsProps) => { | ||
const { categories, className } = props | ||
const l = useFormatMessage() | ||
|
||
return ( | ||
<div className={TokenList.join(["category-buttons__container", className])}> | ||
{categories.map((category) => ( | ||
<Button | ||
as={Link} | ||
key={category} | ||
className="category-button" | ||
content={l(`categories.${category}`)} | ||
href={locations.places({ | ||
categories: [category], | ||
order_by: PlaceListOrderBy.LIKE_SCORE_BEST, | ||
})} | ||
/> | ||
))} | ||
</div> | ||
) | ||
} |
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,33 @@ | ||
.category-filter__box { | ||
margin-right: 8px; | ||
margin-bottom: 8px; | ||
} | ||
|
||
.category-filter__box .dcl.filter .filter-background { | ||
background-color: var(--primary); | ||
opacity: 1; | ||
} | ||
|
||
.category-filter__box--not-active .dcl.filter .filter-background { | ||
background-color: var(--background); | ||
} | ||
|
||
.category-filter__box .dcl.filter > span { | ||
color: var(--text-on-primary); | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.category-filter__box.category-filter__box--not-active .dcl.filter > span { | ||
color: var(--text); | ||
} | ||
|
||
.category-filter__icon { | ||
width: 20px; | ||
height: 20px; | ||
margin-left: 2px; | ||
} | ||
|
||
.category-filter__box > .dcl.filter { | ||
margin-bottom: 2px; | ||
} |
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,41 @@ | ||
import React, { useCallback } from "react" | ||
|
||
import useFormatMessage from "decentraland-gatsby/dist/hooks/useFormatMessage" | ||
import TokenList from "decentraland-gatsby/dist/utils/dom/TokenList" | ||
import { Filter } from "decentraland-ui/dist/components/Filter/Filter" | ||
|
||
import "./CategoryFilter.css" | ||
|
||
export type CategoryFilterProps = { | ||
category: string | ||
onChange?: ( | ||
e: React.MouseEvent<HTMLSpanElement, MouseEvent>, | ||
props: CategoryFilterProps | ||
) => void | ||
active?: boolean | ||
actionIcon?: React.ReactNode | ||
} | ||
|
||
export const CategoryFilter = (props: CategoryFilterProps) => { | ||
const { category, active, onChange, actionIcon } = props | ||
const l = useFormatMessage() | ||
|
||
const handleClick = useCallback( | ||
(e) => onChange && onChange(e, { active: !active, category }), | ||
[active, onChange, category] | ||
) | ||
return ( | ||
<span | ||
className={TokenList.join([ | ||
`category-filter__box`, | ||
!active && "category-filter__box--not-active", | ||
])} | ||
onClick={handleClick} | ||
> | ||
<Filter> | ||
{l(`categories.${category}`)} | ||
{active && <span className="category-filter__icon">{actionIcon}</span>} | ||
</Filter> | ||
</span> | ||
) | ||
} |
Oops, something went wrong.