= ({ onSubmitted }) => {
>
diff --git a/components/layouts/Layout.tsx b/components/layouts/Layout.tsx
index 8c8742c..d48e0f1 100644
--- a/components/layouts/Layout.tsx
+++ b/components/layouts/Layout.tsx
@@ -8,10 +8,15 @@ import { useRouter } from "next/router";
interface LayoutProps {
children: React.ReactNode;
hideSearchBar?: boolean;
+ hideTagLine?: boolean;
+ isMobile: boolean;
}
+
const Layout: FunctionComponent
= ({
children,
hideSearchBar,
+ hideTagLine,
+ isMobile,
}) => {
const router = useRouter();
@@ -47,7 +52,7 @@ const Layout: FunctionComponent = ({
-
+
{!hideSearchBar &&
}
diff --git a/hooks/useismobile.hook.ts b/hooks/useismobile.hook.ts
new file mode 100644
index 0000000..2726af2
--- /dev/null
+++ b/hooks/useismobile.hook.ts
@@ -0,0 +1,22 @@
+import { useEffect, useState } from "react";
+
+const useIsMobile = () => {
+ const [isMobile, setIsMobile] = useState(false);
+
+ useEffect(() => {
+ const handleResize = () => {
+ setIsMobile(
+ window.matchMedia("only screen and (max-width: 912px)").matches,
+ );
+ };
+
+ window.addEventListener("resize", handleResize);
+ handleResize(); // Chiamare la funzione quando il componente viene montato
+
+ return () => window.removeEventListener("resize", handleResize);
+ }, []);
+
+ return isMobile;
+};
+
+export default useIsMobile;
diff --git a/pages/_app.tsx b/pages/_app.tsx
index bff9a1a..3209834 100644
--- a/pages/_app.tsx
+++ b/pages/_app.tsx
@@ -2,14 +2,23 @@ import "../styles/globals.css";
import { Analytics } from "@vercel/analytics/react";
import type { AppProps } from "next/app";
import Layout from "../components/layouts/Layout";
-import { SWRConfig } from "swr";
+import useIsMobile from "../hooks/useismobile.hook";
interface PageProps {
hideSearchBar?: boolean;
+ hideTagLine?: boolean;
+ isMobile: boolean;
}
+
function MyApp({ Component, pageProps }: AppProps) {
+ const isMobile = useIsMobile();
+
return (
-
+
diff --git a/styles/globals.css b/styles/globals.css
index 3dba845..220d986 100644
--- a/styles/globals.css
+++ b/styles/globals.css
@@ -13,6 +13,43 @@ input:-webkit-autofill:active {
-webkit-box-shadow: 0 0 0 100px rgb(249 250 251 / var(--tw-bg-opacity)) inset !important;
}
+input[type="search"]::-webkit-search-cancel-button {
+ -webkit-appearance: none;
+ height: 1em;
+ width: 1em;
+ border-radius: 50%;
+ background: black;
+ color: white;
+ font-size: 1em;
+ font-weight: bold;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+
+@media only screen and (max-width: 768px) {
+ input[type="search"]::-webkit-search-cancel-button {
+ margin-right: 1em;
+ }
+}
+
+input[type="search"]:after::-webkit-search-cancel-button {
+ opacity: 1;
+ color: white;
+ pointer-events: all;
+}
+
+input[type="search"]:focus::-webkit-search-cancel-button {
+ opacity: 1;
+ color: white;
+ cursor: pointer;
+ pointer-events: all;
+}
+
+input[type="search"].dark::-webkit-search-cancel-button {
+ filter: invert(1);
+}
+
.article {
padding: 16px 24px;
position: relative;
@@ -81,6 +118,7 @@ input:-webkit-autofill:active {
.text-summarize {
overflow: hidden;
display: -webkit-box;
+ text-overflow: "...";
-webkit-box-orient: vertical;
-webkit-line-clamp: 10;
}