Merge pull request 'feat: add sideBar active(#36)' (#41) from feature/sideBar-active into main
All checks were successful
it-academy/dry-wash-pl/pipeline/head This commit looks good
All checks were successful
it-academy/dry-wash-pl/pipeline/head This commit looks good
Reviewed-on: #41 Reviewed-by: Primakov Alexandr Alexandrovich <primakovpro@gmail.com>
This commit is contained in:
commit
7025c1a31b
@ -14,8 +14,8 @@ module.exports = {
|
||||
'dry-wash.main': '/dry-wash',
|
||||
'dry-wash.create': '/order',
|
||||
'dry-wash.view.order': '/order/:orderId',
|
||||
'dry-wash.arm.master': '/master',
|
||||
'dry-wash.arm.order': '/order',
|
||||
'dry-wash.arm.master': 'master',
|
||||
'dry-wash.arm.order': 'order',
|
||||
'dry-wash.arm': '/arm/*',
|
||||
},
|
||||
features: {
|
||||
|
@ -1,11 +1,14 @@
|
||||
import { Box, Button, Heading, VStack, Divider } from '@chakra-ui/react';
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useLocation, Link } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { URLs } from '../../__data__/urls';
|
||||
|
||||
const Sidebar = () => {
|
||||
const location = useLocation();
|
||||
const isActive = (keyword: string) => location.pathname.includes(keyword);
|
||||
|
||||
const { t } = useTranslation('~', {
|
||||
keyPrefix: 'dry-wash.arm.master.sideBar',
|
||||
});
|
||||
@ -30,8 +33,8 @@ const Sidebar = () => {
|
||||
as={Link}
|
||||
to={URLs.armOrder.url}
|
||||
w='100%'
|
||||
colorScheme='green'
|
||||
variant='ghost'
|
||||
colorScheme={isActive(URLs.armOrder.url) ? 'green' : 'blue'}
|
||||
variant={isActive(URLs.armOrder.url) ? 'solid' : 'ghost'}
|
||||
>
|
||||
{t('orders')}
|
||||
</Button>
|
||||
@ -42,8 +45,8 @@ const Sidebar = () => {
|
||||
as={Link}
|
||||
to={URLs.armMaster.url}
|
||||
w='100%'
|
||||
colorScheme='green'
|
||||
variant='ghost'
|
||||
colorScheme={isActive(URLs.armMaster.url) ? 'green' : 'blue'}
|
||||
variant={isActive(URLs.armMaster.url) ? 'solid' : 'ghost'}
|
||||
>
|
||||
{t('master')}
|
||||
</Button>
|
||||
|
Loading…
Reference in New Issue
Block a user