@c-rex/templates 0.1.21 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c-rex/templates",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src"
@@ -28,7 +28,7 @@ interface FilterSidebarProps {
28
28
  export const FilterSidebar: FC<FilterSidebarProps> = ({ tags, totalItemCount, updateFilterParam }) => {
29
29
  const t = useTranslations();
30
30
  const device = useBreakpoint();
31
- const isMobile = (device === DEVICE_OPTIONS.MOBILE);
31
+ const isMobile = device !== null && (device === DEVICE_OPTIONS.MOBILE);
32
32
 
33
33
  if (Object.keys(tags).length === 0) return null;
34
34
 
package/src/home/page.tsx CHANGED
@@ -37,7 +37,7 @@ export const HomePage: FC<HomePageProps> = ({ data }) => {
37
37
  const t = useTranslations();
38
38
  const { setLoading } = useSearchContext();
39
39
  const device = useBreakpoint();
40
- const isMobile = device === DEVICE_OPTIONS.MOBILE;
40
+ const isMobile = device !== null && device === DEVICE_OPTIONS.MOBILE;
41
41
  const [open, setOpen] = useState<boolean>(false)
42
42
  const [params, setParams] = useQueryStates({
43
43
  language: parseAsString,
@@ -37,7 +37,7 @@ export const HomePage: FC<HomePageProps> = ({ data }) => {
37
37
  const t = useTranslations();
38
38
  const { setLoading } = useSearchContext();
39
39
  const device = useBreakpoint();
40
- const isMobile = device === DEVICE_OPTIONS.MOBILE;
40
+ const isMobile = device !== null && device === DEVICE_OPTIONS.MOBILE;
41
41
  const [open, setOpen] = useState<boolean>(false)
42
42
  const [params, setParams] = useQueryStates({
43
43
  language: parseAsString,
package/src/utils.ts CHANGED
@@ -3,19 +3,14 @@ import { headers } from "next/headers";
3
3
 
4
4
  const getBrowserLangFromHeader = (): string => {
5
5
  const h = headers();
6
- const accept = h.get("accept-language");
6
+ const accept = h.get("accept-language"); // ex: "pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7"
7
7
 
8
8
  if (!accept) return "";
9
9
 
10
- const primary = accept.split(",")
11
-
12
- if (primary && primary[0]) {
13
- return primary[0].toLowerCase();
14
- }
15
-
16
- return "";
10
+ return accept.split(",")[0]?.toLowerCase() || "";
17
11
  }
18
12
 
13
+
19
14
  export const resolveUILanguage = ({
20
15
  uiLangCookie,
21
16
  defaultLang,