add primary color for active tab

This commit is contained in:
vchikalkin 2024-06-19 15:24:06 +03:00
parent 67749c1ed5
commit 34153fa21a
2 changed files with 8 additions and 6 deletions

View File

@ -8,15 +8,17 @@ const Container = styled.div`
display: flex;
flex-direction: row;
gap: 10px;
height: 40px;
height: 46px;
justify-content: space-around;
position: fixed;
width: 100%;
border-top: 1px solid rgba(5, 5, 5, 0.06);
`;
const TabButton = styled.button`
background: rgba(240, 240, 240);
border-radius: 6px;
background: ${({ active }) => (active ? 'var(--color-primary)' : 'white')};
color: ${({ active }) => (active ? 'white' : 'black')};
border-radius: 2px 2px 0 0;
border: none;
cursor: pointer;
height: 100%;
@ -24,12 +26,12 @@ const TabButton = styled.button`
`;
export function NavigationBar() {
const { setCurrentTab, tabsList } = useContext(NavigationContext);
const { currentTab, setCurrentTab, tabsList } = useContext(NavigationContext);
return (
<Container>
{tabsList.map(({ key, title }) => (
<TabButton key={key} onClick={() => setCurrentTab(key)}>
<TabButton key={key} active={key === currentTab} onClick={() => setCurrentTab(key)}>
{title}
</TabButton>
))}

View File

@ -10,7 +10,7 @@ const Main = styled.main`
margin: 8px 0;
${max('laptop')} {
margin-bottom: 40px; // height of the navigation bar
margin-bottom: calc(46px + 8px); // height of the navigation bar
}
${min('desktop-xl')} {