mirror of
https://github.com/FranP-code/spend-ia.git
synced 2025-10-13 00:14:09 +00:00
feat: added monorepo
This commit is contained in:
51
packages/client/screens/Header/Header.tsx
Normal file
51
packages/client/screens/Header/Header.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
/* eslint-disable no-empty-pattern */
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { useAppStore } from '@/lib/storage';
|
||||
import { type Theme } from '@/lib/theme';
|
||||
import { tabs } from './data';
|
||||
|
||||
export const Header = (): JSX.Element => {
|
||||
const tab = useAppStore((state) => state.tab);
|
||||
const setTab = useAppStore((state) => state.setTab);
|
||||
return (
|
||||
<TabsContainer>
|
||||
{tabs.map((tabData) => (
|
||||
<StyledTab
|
||||
active={tab.id === tabData.id}
|
||||
key={tabData.id}
|
||||
onClick={() => {
|
||||
setTab(tabData);
|
||||
}}
|
||||
>
|
||||
<TabText>{tabData.title}</TabText>
|
||||
</StyledTab>
|
||||
))}
|
||||
</TabsContainer>
|
||||
);
|
||||
};
|
||||
|
||||
const TabsContainer = styled.div`
|
||||
background: ${({ theme }) => theme.colors.secondary};
|
||||
display: flex;
|
||||
`;
|
||||
|
||||
const StyledTab = styled.div<{
|
||||
active: boolean;
|
||||
}>`
|
||||
background: ${({ active, theme }: { active: boolean; theme: Theme }) =>
|
||||
active ? theme.colors.complementary : theme.colors.secondary};
|
||||
padding: 12px 0px;
|
||||
text-align: center;
|
||||
transition: 0.2s ease-in-out all;
|
||||
user-select: none;
|
||||
width: 100%;
|
||||
:hover {
|
||||
filter: ${({ active }) => !active && 'brightness(90%)'};
|
||||
transition: 0.2s ease-in-out all;
|
||||
}
|
||||
`;
|
||||
|
||||
const TabText = styled.h3`
|
||||
color: ${({ theme }: { theme: Theme }) => theme.colors.textColor.primary};
|
||||
`;
|
||||
17
packages/client/screens/Header/data.ts
Normal file
17
packages/client/screens/Header/data.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { SPEND_SCREEN_ID, SPEND_SCREEN_NAME } from '../../lib/constants';
|
||||
import { type Tab } from '../../lib/types';
|
||||
|
||||
export const tabs: Tab[] = [
|
||||
{
|
||||
id: 'tab-1',
|
||||
title: 'Tab 1',
|
||||
},
|
||||
{
|
||||
id: SPEND_SCREEN_ID,
|
||||
title: SPEND_SCREEN_NAME,
|
||||
},
|
||||
{
|
||||
id: 'tab-3',
|
||||
title: 'Tab 3',
|
||||
},
|
||||
];
|
||||
1
packages/client/screens/Header/index.ts
Normal file
1
packages/client/screens/Header/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './Header';
|
||||
Reference in New Issue
Block a user