bigbuffet-rw/app/soapbox/features/remote_timeline/components/pinned_hosts_picker.tsx
marcin mikołajczak 95e037f8c0 TypeScript, React.FC
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-06-09 20:56:14 +02:00

35 lines
858 B
TypeScript

'use strict';
import React from 'react';
import { Button, HStack } from 'soapbox/components/ui';
import { useSettings } from 'soapbox/hooks';
interface IPinnedHostsPicker {
/** The active host among pinned hosts. */
host?: string,
}
const PinnedHostsPicker: React.FC<IPinnedHostsPicker> = ({ host: activeHost }) => {
const settings = useSettings();
const pinnedHosts = settings.getIn(['remote_timeline', 'pinnedHosts']) as any;
if (!pinnedHosts || pinnedHosts.isEmpty()) return null;
return (
<HStack className='mb-4' space={2}>
{pinnedHosts.map((host: any) => (
<Button
key={host}
to={`/timeline/${host}`}
size='sm'
theme={host === activeHost ? 'accent' : 'secondary'}
>
{host}
</Button>
))}
</HStack>
);
};
export default PinnedHostsPicker;