mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-20 06:29:32 +02:00
fix: show Use this tool only if medium breakpoint
This commit is contained in:
@@ -10,6 +10,7 @@ import { useEffect, useState } from 'react';
|
|||||||
import { isBookmarked, toggleBookmarked } from '@utils/bookmark';
|
import { isBookmarked, toggleBookmarked } from '@utils/bookmark';
|
||||||
import IconButton from '@mui/material/IconButton';
|
import IconButton from '@mui/material/IconButton';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
||||||
|
|
||||||
const StyledButton = styled(Button)(({ theme }) => ({
|
const StyledButton = styled(Button)(({ theme }) => ({
|
||||||
backgroundColor: 'white',
|
backgroundColor: 'white',
|
||||||
@@ -30,6 +31,8 @@ interface ToolHeaderProps {
|
|||||||
function ToolLinks() {
|
function ToolLinks() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [examplesVisible, setExamplesVisible] = useState(false);
|
const [examplesVisible, setExamplesVisible] = useState(false);
|
||||||
|
const theme = useTheme();
|
||||||
|
const isMd = useMediaQuery(theme.breakpoints.down('md'));
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
@@ -50,16 +53,18 @@ function ToolLinks() {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Grid container spacing={2} mt={1}>
|
<Grid container spacing={2} mt={1}>
|
||||||
<Grid item md={12} lg={6}>
|
{isMd && (
|
||||||
<StyledButton
|
<Grid item md={12} lg={6}>
|
||||||
sx={{ backgroundColor: 'background.paper' }}
|
<StyledButton
|
||||||
fullWidth
|
sx={{ backgroundColor: 'background.paper' }}
|
||||||
variant="outlined"
|
fullWidth
|
||||||
onClick={() => scrollToElement('tool')}
|
variant="outlined"
|
||||||
>
|
onClick={() => scrollToElement('tool')}
|
||||||
Use This Tool
|
>
|
||||||
</StyledButton>
|
Use This Tool
|
||||||
</Grid>
|
</StyledButton>
|
||||||
|
</Grid>
|
||||||
|
)}
|
||||||
{examplesVisible && (
|
{examplesVisible && (
|
||||||
<Grid item md={12} lg={6}>
|
<Grid item md={12} lg={6}>
|
||||||
<StyledButton
|
<StyledButton
|
||||||
|
Reference in New Issue
Block a user