hyper/lib/components/style-sheet.tsx

32 lines
756 B
TypeScript
Raw Normal View History

2023-07-23 11:21:04 -08:00
import React, {forwardRef} from 'react';
2023-07-25 09:30:19 -08:00
2026-01-04 05:23:11 -09:00
import {useDevicePixelRatio} from 'use-device-pixel-ratio';
2023-07-25 01:39:51 -08:00
import type {StyleSheetProps} from '../../typings/hyper';
2017-06-11 02:42:39 -08:00
2023-07-24 23:01:01 -08:00
const StyleSheet = forwardRef<HTMLStyleElement, StyleSheetProps>((props, ref) => {
const {borderColor} = props;
2017-06-11 02:42:39 -08:00
const dpr = useDevicePixelRatio();
return (
2023-07-23 11:21:04 -08:00
<style jsx global ref={ref}>{`
::-webkit-scrollbar {
width: ${5 * dpr}px;
}
::-webkit-scrollbar-thumb {
-webkit-border-radius: 10px;
border-radius: 10px;
background: ${borderColor};
}
::-webkit-scrollbar-thumb:window-inactive {
background: ${borderColor};
}
`}</style>
);
2023-07-23 11:21:04 -08:00
});
StyleSheet.displayName = 'StyleSheet';
export default StyleSheet;