-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2266 from daostack/CW-2256-unread-filtretation-inbox
Add see unread only filteration in the Inbox #2256
- Loading branch information
Showing
10 changed files
with
173 additions
and
6 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
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
29 changes: 29 additions & 0 deletions
29
src/pages/inbox/components/InboxFilterButton/InboxFilterButton.module.scss
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,29 @@ | ||
@import "../../../../constants"; | ||
@import "../../../../styles/sizes"; | ||
|
||
.buttonIcon { | ||
background-color: transparent; | ||
|
||
@media (hover: hover) and (pointer: fine) { | ||
&:hover { | ||
background-color: $light-gray-1; | ||
} | ||
} | ||
} | ||
|
||
.unreadFilterActive { | ||
background-color: $c-pink-next-dark; | ||
color: $white; | ||
|
||
@media (hover: hover) and (pointer: fine) { | ||
&:hover { | ||
background-color: $c-pink-mention-2; | ||
} | ||
} | ||
} | ||
|
||
.icon { | ||
width: 1.5rem; | ||
height: 1.5rem; | ||
color: inherit; | ||
} |
47 changes: 47 additions & 0 deletions
47
src/pages/inbox/components/InboxFilterButton/InboxFilterButton.tsx
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 @@ | ||
import React, { FC } from "react"; | ||
import { useHistory, useLocation } from "react-router"; | ||
import classnames from "classnames"; | ||
import { QueryParamKey } from "@/shared/constants"; | ||
import { useQueryParams, useRemoveQueryParams } from "@/shared/hooks"; | ||
import { InboxFilterIcon } from "@/shared/icons"; | ||
import { ButtonIcon } from "@/shared/ui-kit"; | ||
import styles from "./InboxFilterButton.module.scss"; | ||
|
||
interface InboxFilterButtonProps { | ||
className?: string; | ||
} | ||
|
||
const InboxFilterButton: FC<InboxFilterButtonProps> = (props) => { | ||
const { className } = props; | ||
const history = useHistory(); | ||
const location = useLocation(); | ||
const queryParams = useQueryParams(); | ||
const { removeQueryParams } = useRemoveQueryParams(); | ||
const isActiveUnreadInboxItemsQueryParam = | ||
queryParams[QueryParamKey.Unread] === "true"; | ||
|
||
const handleFilterIconClick = (): void => { | ||
if (isActiveUnreadInboxItemsQueryParam) { | ||
removeQueryParams(QueryParamKey.Unread); | ||
} else { | ||
history.push(`${location.pathname}?${QueryParamKey.Unread}=true`); | ||
} | ||
}; | ||
|
||
return ( | ||
<ButtonIcon | ||
className={classnames(styles.buttonIcon, className, { | ||
[styles.unreadFilterActive]: isActiveUnreadInboxItemsQueryParam, | ||
})} | ||
onClick={handleFilterIconClick} | ||
> | ||
<InboxFilterIcon | ||
className={classnames(styles.icon, { | ||
[styles.iconActive]: isActiveUnreadInboxItemsQueryParam, | ||
})} | ||
/> | ||
</ButtonIcon> | ||
); | ||
}; | ||
|
||
export default InboxFilterButton; |
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 @@ | ||
export { default as InboxFilterButton } from "./InboxFilterButton"; |
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,51 @@ | ||
import React, { FC } from "react"; | ||
|
||
interface InboxFilterIconProps { | ||
className?: string; | ||
} | ||
|
||
const InboxFilterIcon: FC<InboxFilterIconProps> = ({ className }) => { | ||
return ( | ||
<svg | ||
className={className} | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M8 9H16" | ||
stroke="currentColor" | ||
stroke-width="1.5" | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
/> | ||
<path | ||
d="M8 13H14" | ||
stroke="currentColor" | ||
stroke-width="1.5" | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
/> | ||
<path | ||
d="M12 21L11 20L9 18H6C5.20435 18 4.44129 17.6839 3.87868 17.1213C3.31607 16.5587 3 15.7956 3 15V7C3 6.20435 3.31607 5.44129 3.87868 4.87868C4.44129 4.31607 5.20435 4 6 4H18C18.7956 4 19.5587 4.31607 20.1213 4.87868C20.6839 5.44129 21 6.20435 21 7V13" | ||
stroke="currentColor" | ||
stroke-width="1.5" | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
/> | ||
<circle | ||
cx="18" | ||
cy="18" | ||
r="3" | ||
stroke="currentColor" | ||
stroke-width="1.5" | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
/> | ||
</svg> | ||
); | ||
}; | ||
|
||
export default InboxFilterIcon; |
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