import React from 'react';
import { IcExternalLink, IcNavBackArrow, IcNavForward } from '../res/icons';
import { useSpotifyGestures } from '../hooks/useSpotifyGestures';
import { useSpotifyStrings } from '../hooks/useSpotifyStrings';
export const Header = ({ title }: { title: string }) => {
const { bindBack } = useSpotifyGestures();
return (
);
};
export const SectionHeader = ({ title }: { title: string }) => (
{title}
);
type RowTapProps = React.HTMLAttributes;
type ButtonTapProps = React.ButtonHTMLAttributes;
export const ToggleRow = ({
title,
desc,
isOn,
onClick,
tapProps,
}: {
title: string;
desc?: string;
isOn: boolean;
onClick?: () => void;
tapProps?: RowTapProps;
}) => {
const { className, onClick: tapOnClick, ...rest } = tapProps ?? {};
return (
);
};
export const LinkRow = ({
title,
desc,
value,
onClick,
tapProps,
}: {
title: string;
desc?: string;
value?: string;
onClick?: () => void;
tapProps?: RowTapProps;
}) => {
const { className, onClick: tapOnClick, ...rest } = tapProps ?? {};
return (
);
};
export const InfoText = ({ text }: { text: string }) => (
{text}
);
export const AppRow = ({
iconSrc,
name,
btnText,
onClick,
buttonProps,
}: {
iconSrc: string;
name: string;
btnText?: string;
onClick?: () => void;
buttonProps?: ButtonTapProps;
}) => {
const s = useSpotifyStrings();
const { className, onClick: buttonOnClick, ...rest } = buttonProps ?? {};
return (
{name}
);
};
export const RadioRow = ({
label,
selected,
onClick,
showPremium,
tapProps,
}: {
label: string;
selected: boolean;
onClick?: () => void;
showPremium?: boolean;
tapProps?: RowTapProps;
}) => {
const { className, onClick: tapOnClick, ...rest } = tapProps ?? {};
return (
{label}
{showPremium && (
S
Premium
)}
);
};
export const TextIconRow = ({
title,
value,
onClick,
icon: Icon = IcNavForward,
linkIcon,
tapProps,
}: {
title: string;
value?: string;
onClick?: () => void;
icon?: any;
linkIcon?: boolean;
tapProps?: RowTapProps;
}) => {
const { className, onClick: tapOnClick, ...rest } = tapProps ?? {};
return (
{title}
{value && {value}}
{linkIcon ? : }
);
};