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) => {
|
2023-07-15 20:20:55 -08:00
|
|
|
const {borderColor} = props;
|
2017-06-11 02:42:39 -08:00
|
|
|
|
2025-06-15 16:22:21 -08:00
|
|
|
const dpr = useDevicePixelRatio();
|
|
|
|
|
|
2023-07-15 20:20:55 -08:00
|
|
|
return (
|
2023-07-23 11:21:04 -08:00
|
|
|
<style jsx global ref={ref}>{`
|
2023-07-15 20:20:55 -08:00
|
|
|
::-webkit-scrollbar {
|
2025-06-15 16:22:21 -08:00
|
|
|
width: ${5 * dpr}px;
|
2023-07-15 20:20:55 -08:00
|
|
|
}
|
|
|
|
|
::-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';
|
2023-07-15 20:20:55 -08:00
|
|
|
|
|
|
|
|
export default StyleSheet;
|