import styles from './header.module.scss';
import { TopBar } from '@/components/topBar';
import useLocale from '@/utils/useLocale';
import { LocalesMap } from '@/utils/useLocale';
import { clsx } from 'clsx';
import LoveIcon from '@/assets/icons/love.svg';
import OpenSourceIcon from '@/assets/icons/open-source.svg';
import { Gradients } from '@/components/gradients';
import ContributeArrow from '@/assets/images/contribute-arrow.svg';
import ContributeArrowInvert from '@/assets/images/contribute-arrow-invert.svg';
import { useEffect, useRef, useState } from 'react';
import useMediaQuery from '@/utils/useMediaQuery';
export const locales: LocalesMap = {
ru: {
appName: 'RideBus',
description: (
<>
RideBus — это хобби-проект{' '}
и я не планирую на нём зарабатывать,{' '}
если вы хотите помочь, вот способ, как это сделать
>
),
openSource: 'Open source',
madeWithLove: 'Сделано с',
},
en: {
appName: 'RideBus',
description: (
<>
RideBus is a hobby project{' '}
and I do not plan to earn money on it,{' '}
if you want to help, here is a way how to do it
>
),
openSource: 'Open source',
madeWithLove: 'Made with',
},
};
function Arrow() {
const rootRef = useRef(null);
const [isInvertArrow, setIsInvertArrow] = useState(false);
const breakpoint640 = useMediaQuery('(max-width: 640px)');
const breakpoint800 = useMediaQuery('(max-width: 800px)');
useEffect(() => {
const arrowWidth = breakpoint640 ? 260 : breakpoint800 ? 300 : 460;
const handleResize = () => {
if (rootRef.current) {
const { left } = rootRef.current.getBoundingClientRect();
if (window.innerWidth < left + arrowWidth) {
setIsInvertArrow(true);
} else {
setIsInvertArrow(false);
}
}
};
window.addEventListener('resize', handleResize);
return () => {
window.removeEventListener('resize', handleResize);
};
}, [breakpoint640, breakpoint800]);
let left = isInvertArrow ? '-130px' : '26px';
if (breakpoint640) {
left = isInvertArrow ? '-95px' : '16px';
}
if (breakpoint800) {
left = isInvertArrow ? '-95px' : '16px';
}
return (
{isInvertArrow ? : }
)
}
type ChipProps = {
className?: string;
label: string;
icon: any;
};
function Chip(props: ChipProps) {
const { className, label, icon } = props;
return (
{label}
{icon}
);
}
export function Header() {
const t = useLocale(locales);
return (
{t('description')}
)} />
)} />
);
}