mirror of
https://github.com/FranP-code/spend-ia.git
synced 2025-10-13 00:14:09 +00:00
integration of next.js
This commit is contained in:
48
screens/Header/Header.tsx
Normal file
48
screens/Header/Header.tsx
Normal file
@@ -0,0 +1,48 @@
|
||||
import React from 'react';
|
||||
import { tabs } from './data';
|
||||
import { type Tab } from '@/lib/types';
|
||||
import styled from 'styled-components';
|
||||
|
||||
export const Header = ({
|
||||
tab,
|
||||
setTab,
|
||||
}: {
|
||||
tab: Tab;
|
||||
setTab: React.Dispatch<React.SetStateAction<Tab>>;
|
||||
}): JSX.Element => {
|
||||
return (
|
||||
<TabsContainer>
|
||||
{tabs.map((tabData) => (
|
||||
<StyledTab
|
||||
active={tab.id === tabData.id}
|
||||
key={tabData.id}
|
||||
onClick={() => {
|
||||
setTab(tabData);
|
||||
}}
|
||||
>
|
||||
<h3>{tabData.title}</h3>
|
||||
</StyledTab>
|
||||
))}
|
||||
</TabsContainer>
|
||||
);
|
||||
};
|
||||
|
||||
const TabsContainer = styled.div`
|
||||
background: #635985;
|
||||
display: flex;
|
||||
`;
|
||||
|
||||
const StyledTab = styled.div<{
|
||||
active: boolean;
|
||||
}>`
|
||||
background: ${({ active }) => (active ? '#443C68' : '#635985')};
|
||||
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;
|
||||
}
|
||||
`;
|
||||
17
screens/Header/data.ts
Normal file
17
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
screens/Header/index.ts
Normal file
1
screens/Header/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './Header';
|
||||
Reference in New Issue
Block a user