mirror of
https://github.com/timmypidashev/web.git
synced 2026-04-14 02:53:51 +00:00
Rework mobile device detection
This commit is contained in:
@@ -41,7 +41,7 @@ export default function AnimationSwitcher() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="fixed bottom-4 left-4 z-[101] pointer-events-auto hidden lg:block"
|
className="fixed bottom-4 left-4 z-[101] pointer-events-auto hidden desk:block"
|
||||||
onMouseEnter={() => setHovering(true)}
|
onMouseEnter={() => setHovering(true)}
|
||||||
onMouseLeave={() => setHovering(false)}
|
onMouseLeave={() => setHovering(false)}
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
|
|||||||
@@ -333,11 +333,11 @@ const Background: React.FC<BackgroundProps> = ({
|
|||||||
const getContainerClasses = () => {
|
const getContainerClasses = () => {
|
||||||
if (isIndex) {
|
if (isIndex) {
|
||||||
return mobileOnly
|
return mobileOnly
|
||||||
? "fixed inset-0 -z-10 lg:hidden"
|
? "fixed inset-0 -z-10 desk:hidden"
|
||||||
: "fixed inset-0 -z-10";
|
: "fixed inset-0 -z-10";
|
||||||
}
|
}
|
||||||
|
|
||||||
const baseClasses = "fixed top-0 bottom-0 hidden lg:block -z-10";
|
const baseClasses = "fixed top-0 bottom-0 hidden desk:block -z-10";
|
||||||
return position === "left"
|
return position === "left"
|
||||||
? `${baseClasses} left-0`
|
? `${baseClasses} left-0`
|
||||||
: `${baseClasses} right-0`;
|
: `${baseClasses} right-0`;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default function Footer({ fixed = false }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<footer className={`w-full font-bold pointer-events-none ${fixed ? "fixed bottom-0 left-0 right-0" : ""}`}>
|
<footer className={`w-full font-bold pointer-events-none ${fixed ? "fixed bottom-0 left-0 right-0" : ""}`}>
|
||||||
<div className="hidden lg:flex flex-row px-2 py-1 text-lg lg:px-6 lg:py-1.5 lg:text-3xl md:text-2xl justify-between md:justify-center space-x-2 md:space-x-10 lg:space-x-20 pointer-events-none [&_a]:pointer-events-auto">
|
<div className="hidden desk:flex flex-row px-2 py-1 text-lg lg:px-6 lg:py-1.5 lg:text-3xl md:text-2xl justify-between md:justify-center space-x-2 md:space-x-10 lg:space-x-20 pointer-events-none [&_a]:pointer-events-auto">
|
||||||
{footerLinks}
|
{footerLinks}
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export default function Header({ transparent = false }: { transparent?: boolean
|
|||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
<div className={`
|
<div className={`
|
||||||
w-full hidden lg:flex flex-row items-center justify-center
|
w-full hidden desk:flex flex-row items-center justify-center
|
||||||
pointer-events-none
|
pointer-events-none
|
||||||
${!isIndexPage ? 'bg-background md:bg-transparent' : ''}
|
${!isIndexPage ? 'bg-background md:bg-transparent' : ''}
|
||||||
`}>
|
`}>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export default function MobileNav({ transparent = false }: { transparent?: boole
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<nav
|
<nav
|
||||||
className={`fixed bottom-0 left-0 right-0 z-50 lg:hidden transition-transform duration-300 ${
|
className={`fixed bottom-0 left-0 right-0 z-50 desk:hidden transition-transform duration-300 ${
|
||||||
visible ? "translate-y-0" : "translate-y-full"
|
visible ? "translate-y-0" : "translate-y-full"
|
||||||
} ${
|
} ${
|
||||||
transparent
|
transparent
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ export default function ThemeSwitcher() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
className="fixed bottom-4 right-4 z-[101] pointer-events-auto hidden lg:block"
|
className="fixed bottom-4 right-4 z-[101] pointer-events-auto hidden desk:block"
|
||||||
onMouseEnter={() => setHovering(true)}
|
onMouseEnter={() => setHovering(true)}
|
||||||
onMouseLeave={() => setHovering(false)}
|
onMouseLeave={() => setHovering(false)}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ const ogImage = "https://timmypidashev.dev/og-image.jpg";
|
|||||||
handleFocus={false}
|
handleFocus={false}
|
||||||
/>
|
/>
|
||||||
<script is:inline>
|
<script is:inline>
|
||||||
if (window.innerWidth < 1024) {
|
if (window.innerWidth < 1024 || navigator.maxTouchPoints > 0) {
|
||||||
document.addEventListener('click', function(e) {
|
document.addEventListener('click', function(e) {
|
||||||
var a = e.target.closest('a[href]');
|
var a = e.target.closest('a[href]');
|
||||||
if (a && a.href && !a.target && a.origin === location.origin) {
|
if (a && a.href && !a.target && a.origin === location.origin) {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ const ogImage = "https://timmypidashev.dev/og-image.jpg";
|
|||||||
<link rel="sitemap" href="/sitemap-index.xml" />
|
<link rel="sitemap" href="/sitemap-index.xml" />
|
||||||
<ClientRouter />
|
<ClientRouter />
|
||||||
<script is:inline>
|
<script is:inline>
|
||||||
if (window.innerWidth < 1024) {
|
if (window.innerWidth < 1024 || navigator.maxTouchPoints > 0) {
|
||||||
document.addEventListener('click', function(e) {
|
document.addEventListener('click', function(e) {
|
||||||
var a = e.target.closest('a[href]');
|
var a = e.target.closest('a[href]');
|
||||||
if (a && a.href && !a.target && a.origin === location.origin) {
|
if (a && a.href && !a.target && a.origin === location.origin) {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ const ogImage = "https://timmypidashev.dev/og-image.jpg";
|
|||||||
handleFocus={false}
|
handleFocus={false}
|
||||||
/>
|
/>
|
||||||
<script is:inline>
|
<script is:inline>
|
||||||
if (window.innerWidth < 1024) {
|
if (window.innerWidth < 1024 || navigator.maxTouchPoints > 0) {
|
||||||
document.addEventListener('click', function(e) {
|
document.addEventListener('click', function(e) {
|
||||||
var a = e.target.closest('a[href]');
|
var a = e.target.closest('a[href]');
|
||||||
if (a && a.href && !a.target && a.origin === location.origin) {
|
if (a && a.href && !a.target && a.origin === location.origin) {
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
content: ["./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}"],
|
content: ["./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}"],
|
||||||
theme: {
|
theme: {
|
||||||
|
screens: {
|
||||||
|
sm: "640px",
|
||||||
|
md: "768px",
|
||||||
|
lg: "1024px",
|
||||||
|
xl: "1280px",
|
||||||
|
"2xl": "1536px",
|
||||||
|
// Desktop = wide screen + non-touch pointer. Used for mobile/desktop layout split.
|
||||||
|
desk: { raw: "(min-width: 1024px) and (hover: hover) and (pointer: fine)" },
|
||||||
|
},
|
||||||
extend: {
|
extend: {
|
||||||
fontFamily: {
|
fontFamily: {
|
||||||
"comic-code": ["Comic Code", "monospace"],
|
"comic-code": ["Comic Code", "monospace"],
|
||||||
|
|||||||
Reference in New Issue
Block a user