mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-14 20:40:21 +02:00
37 lines
833 B
TypeScript
37 lines
833 B
TypeScript
import { motion } from 'framer-motion';
|
|
import styled from 'styled-components';
|
|
import { useShouldPadTitlebar } from '/@/hooks';
|
|
|
|
const Container = styled(motion.div)``;
|
|
|
|
const Header = styled(motion.div)<{ $padRight?: boolean }>`
|
|
margin-right: 170px;
|
|
padding: 1rem;
|
|
-webkit-app-region: drag;
|
|
|
|
button {
|
|
-webkit-app-region: no-drag;
|
|
}
|
|
`;
|
|
|
|
interface PageHeaderProps {
|
|
backgroundColor?: string;
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
export const PageHeader = ({ backgroundColor, children }: PageHeaderProps) => {
|
|
const padRight = useShouldPadTitlebar();
|
|
|
|
return (
|
|
<Container
|
|
animate={{
|
|
backgroundColor,
|
|
transition: { duration: 1.5 },
|
|
}}
|
|
initial={{ backgroundColor: 'transparent', color: 'white' }}
|
|
>
|
|
<Header $padRight={padRight}>{children}</Header>
|
|
</Container>
|
|
);
|
|
};
|