mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
Add "Install App" button to the toolbar using react-use-pwa-install
library
This commit is contained in:
34
packages/client/src/components/InstallButton.tsx
Normal file
34
packages/client/src/components/InstallButton.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import { IconButton } from '@chakra-ui/react';
|
||||
import { HardDriveDownload } from 'lucide-react';
|
||||
import React from 'react';
|
||||
import { usePWAInstall } from 'react-use-pwa-install';
|
||||
|
||||
import { toolbarButtonZIndex } from './toolbar/Toolbar.tsx';
|
||||
|
||||
function InstallButton() {
|
||||
const install = usePWAInstall();
|
||||
|
||||
// <button onClick={handleInstall}>Install App</button>;
|
||||
return (
|
||||
<IconButton
|
||||
aria-label="Install App"
|
||||
title="Install App"
|
||||
icon={<HardDriveDownload />}
|
||||
size="md"
|
||||
bg="transparent"
|
||||
stroke="text.accent"
|
||||
color="text.accent"
|
||||
onClick={() => install}
|
||||
_hover={{
|
||||
bg: 'transparent',
|
||||
svg: {
|
||||
stroke: 'accent.secondary',
|
||||
transition: 'stroke 0.3s ease-in-out',
|
||||
},
|
||||
}}
|
||||
zIndex={toolbarButtonZIndex}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default InstallButton;
|
Reference in New Issue
Block a user