-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
125 changed files
with
11,189 additions
and
1,133 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.