Compare commits

...

5 Commits

Author SHA1 Message Date
7025c1a31b 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
Reviewed-on: #41
Reviewed-by: Primakov Alexandr Alexandrovich <primakovpro@gmail.com>
2024-11-25 10:11:52 +03:00
2d55f26de5 Merge remote-tracking branch 'origin/feature/sideBar-active' into feature/sideBar-active
All checks were successful
it-academy/dry-wash-pl/pipeline/pr-main This commit looks good
# Conflicts:
#	src/components/Sidebar/Sidebar.tsx
2024-11-24 22:40:44 +03:00
da244adee0 fix: Update URL references and conditional checks (#36) 2024-11-24 22:37:19 +03:00
5d1a679c68 feat: add sideBar active(#36) 2024-11-24 22:31:21 +03:00
9eb0080d13 feat: add sideBar active(#36)
Some checks failed
it-academy/dry-wash-pl/pipeline/head This commit looks good
it-academy/dry-wash-pl/pipeline/pr-main There was a failure building this commit
2024-11-23 18:34:53 +03:00
2 changed files with 10 additions and 7 deletions

View File

@ -14,8 +14,8 @@ module.exports = {
'dry-wash.main': '/dry-wash', 'dry-wash.main': '/dry-wash',
'dry-wash.create': '/order', 'dry-wash.create': '/order',
'dry-wash.view.order': '/order/:orderId', 'dry-wash.view.order': '/order/:orderId',
'dry-wash.arm.master': '/master', 'dry-wash.arm.master': 'master',
'dry-wash.arm.order': '/order', 'dry-wash.arm.order': 'order',
'dry-wash.arm': '/arm/*', 'dry-wash.arm': '/arm/*',
}, },
features: { features: {

View File

@ -1,11 +1,14 @@
import { Box, Button, Heading, VStack, Divider } from '@chakra-ui/react'; import { Box, Button, Heading, VStack, Divider } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import { Link } from 'react-router-dom'; import { useLocation, Link } from 'react-router-dom';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { URLs } from '../../__data__/urls'; import { URLs } from '../../__data__/urls';
const Sidebar = () => { const Sidebar = () => {
const location = useLocation();
const isActive = (keyword: string) => location.pathname.includes(keyword);
const { t } = useTranslation('~', { const { t } = useTranslation('~', {
keyPrefix: 'dry-wash.arm.master.sideBar', keyPrefix: 'dry-wash.arm.master.sideBar',
}); });
@ -30,8 +33,8 @@ const Sidebar = () => {
as={Link} as={Link}
to={URLs.armOrder.url} to={URLs.armOrder.url}
w='100%' w='100%'
colorScheme='green' colorScheme={isActive(URLs.armOrder.url) ? 'green' : 'blue'}
variant='ghost' variant={isActive(URLs.armOrder.url) ? 'solid' : 'ghost'}
> >
{t('orders')} {t('orders')}
</Button> </Button>
@ -42,8 +45,8 @@ const Sidebar = () => {
as={Link} as={Link}
to={URLs.armMaster.url} to={URLs.armMaster.url}
w='100%' w='100%'
colorScheme='green' colorScheme={isActive(URLs.armMaster.url) ? 'green' : 'blue'}
variant='ghost' variant={isActive(URLs.armMaster.url) ? 'solid' : 'ghost'}
> >
{t('master')} {t('master')}
</Button> </Button>