bigbuffet-rw/app/soapbox/features/remote_timeline/components/pinned_hosts_picker.tsx

36 lines
858 B
TypeScript
Raw Normal View History

2022-05-09 19:59:30 -07:00
'use strict';
import React from 'react';
import { Button, HStack } from 'soapbox/components/ui';
2022-05-09 19:59:30 -07:00
import { useSettings } from 'soapbox/hooks';
interface IPinnedHostsPicker {
/** The active host among pinned hosts. */
host?: string,
2022-05-09 19:59:30 -07:00
}
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}>
2022-05-09 19:59:30 -07:00
{pinnedHosts.map((host: any) => (
<Button
key={host}
to={`/timeline/${host}`}
size='sm'
theme={host === activeHost ? 'accent' : 'secondary'}
>
{host}
</Button>
2022-05-09 19:59:30 -07:00
))}
</HStack>
2022-05-09 19:59:30 -07:00
);
};
export default PinnedHostsPicker;