mirror of https://github.com/lukechilds/docs.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
669 B
15 lines
669 B
import React, { forwardRef, Ref } from 'react';
|
|
import { LinkProps } from '@components/typography';
|
|
import { useColorMode } from '@blockstack/ui';
|
|
import { DarkModeIcon } from '@components/icons/dark-mode';
|
|
import { LightModeIcon } from '@components/icons/light-mode';
|
|
import { IconButton } from '@components/icon-button';
|
|
|
|
export const ColorModeButton = forwardRef((props: LinkProps, ref: Ref<HTMLDivElement>) => {
|
|
const { colorMode, toggleColorMode } = useColorMode();
|
|
return (
|
|
<IconButton onClick={toggleColorMode} title="Toggle color mode" {...props} ref={ref}>
|
|
{colorMode === 'dark' ? <DarkModeIcon /> : <LightModeIcon />}
|
|
</IconButton>
|
|
);
|
|
});
|
|
|