Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: changing pop-over x button for hover :) and adding padding to the popover to make it more visible #1012

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions apps/antalmanac/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import './App.css';

import { createBrowserRouter, RouterProvider } from 'react-router-dom';
import { TourProvider } from '@reactour/tour';
import { SnackbarProvider } from 'notistack';
import { useEffect } from 'react';
import ReactGA4 from 'react-ga4';
import { createBrowserRouter, RouterProvider } from 'react-router-dom';

import { TourProvider } from '@reactour/tour';
import { undoDelete } from './actions/AppStoreActions';
import AppQueryProvider from './providers/Query';
import AppThemeProvider from './providers/Theme';
import AppThemev5Provider from './providers/Themev5';

import Home from './routes/Home';
import Feedback from './routes/Feedback';
import Home from './routes/Home';

import { CloseButton } from '$components/buttons/CloseButton';

const BrowserRouter = createBrowserRouter([
{
Expand Down Expand Up @@ -49,6 +50,9 @@ export default function App() {
<TourProvider
steps={[] /** Will be populated by Tutorial component */}
padding={5}
// React Tour allows adding custom components to the tour to which we can pass props
// Or you can add styling to the existing components
components={{ Close: (props) => <CloseButton {...props} /> }}
styles={{
maskArea: (base, _) => ({
// The highlighted area
Expand All @@ -67,7 +71,22 @@ export default function App() {
color: 'black',
borderRadius: 5,
boxShadow: '0 0 10px #000',
padding: 20,
marginLeft: 10,
marginRight: 10,
marginTop: 10,
marginBottom: 10,
paddingTop: 20,
paddingBottom: 20,
paddingLeft: 35,
paddingRight: 35,
}),
controls: (base) => ({
...base,
display: 'flex',
width: '100%',
justifyContent: 'space-between',
alignItems: 'center',
marginTop: 10,
}),
}}
>
Expand Down
50 changes: 50 additions & 0 deletions apps/antalmanac/src/components/buttons/CloseButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { Close as CloseIcon } from '@mui/icons-material';
import { IconButton } from '@mui/material';
import { MouseEventHandler } from 'react';
// Making a Custom MUI Close Button for the Tour Component
export const CloseButton = ({
onClick,
disabled,
...props
}: {
onClick?: MouseEventHandler<HTMLButtonElement>;
disabled?: boolean;
}) => {
return (
<IconButton
aria-label="Close Tour"
disabled={disabled}
onClick={onClick}
{...props}
sx={{
borderRadius: '50%',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
padding: '3px',
backgroundColor: '#007bff',
cursor: 'pointer',
position: 'absolute',
top: '-15px',
right: '-15px',
width: '35px',
height: '35px',
transition: 'background 0.3s, opacity 0.3s',
'&:hover': {
backgroundColor: '#0056b3',
},
}}
>
<CloseIcon
sx={{
height: '20px',
width: '20px',
color: 'white',
'&:hover': {
color: '#d3d3d3',
},
}}
/>
</IconButton>
);
};