diff --git a/components/PlatformDisplay.tsx b/components/PlatformDisplay.tsx new file mode 100644 index 0000000..902763c --- /dev/null +++ b/components/PlatformDisplay.tsx @@ -0,0 +1,13 @@ +import { ReactNode } from 'react' + +const PlatformDisplay = ({ osx, children }:PlatformDisplayProps): JSX.Element => { + const isOSX = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform) + return <>{isOSX ? osx ?? children : children}> +} + +interface PlatformDisplayProps { + osx?: ReactNode + children: ReactNode +} + +export default PlatformDisplay \ No newline at end of file diff --git a/pages/_app.tsx b/pages/_app.tsx index 69276a7..0d5648e 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -24,6 +24,7 @@ import 'core-js/es/map' import '../app.css' import '../github-markdown.css' import '@fortawesome/fontawesome-free/css/all.css' +import PlatformDisplay from '@components/PlatformDisplay' init() @@ -83,11 +84,20 @@ export default function App({ Component, pageProps, err }: KoreanbotsProps): JSX