-
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.
feat: add button redirect to profile
- Loading branch information
Showing
4 changed files
with
36 additions
and
4 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export { ButtonRedirectProfile } from './ui/button-redirect-profile' |
25 changes: 25 additions & 0 deletions
25
src/features/button-redirect-profile/ui/button-redirect-profile.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,25 @@ | ||
import { selectUser } from '@app/store/reducers/profileInfo/selectors' | ||
import { useAppSelector } from '@shared/lib/hooks/store-hooks' | ||
import { Button } from '@shared/ui/button' | ||
import { type FC } from 'react' | ||
import { useNavigate } from 'react-router-dom' | ||
|
||
interface IButtonRedirectProfileProps { | ||
className?: string | ||
} | ||
const ButtonRedirectProfile: FC<IButtonRedirectProfileProps> = ({ className }) => { | ||
const navigate = useNavigate() | ||
const user = useAppSelector(selectUser) | ||
return ( | ||
<Button | ||
className={className} | ||
variant='outline' | ||
onClick={() => { | ||
navigate(`/main/users/${user?.id}`) | ||
}} | ||
> | ||
Моя страница | ||
</Button> | ||
) | ||
} | ||
export { ButtonRedirectProfile } |
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