Skip to content

Commit e300535

Browse files
committed
Bugfix wave 1
Add `xs` viewport Add scroll into view on search bar click / focus / highlight Fix tablet visualization of some cards Fix responsiveness of homepage texts Fix highlight animation not being removed
1 parent 353a5be commit e300535

File tree

10 files changed

+49
-21
lines changed

10 files changed

+49
-21
lines changed

components/course-card/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ const CourseCard: React.FC<CourseCardProps> = ({ data }) => {
3636
position="relative"
3737
_hover={{ shadow: "md" }}
3838
bg={useColorModeValue("gray.50", "gray.700")}
39-
w={{ base: "full", lg: "178px" }}
40-
h={{ base: "72px", lg: "160px" }}
39+
w={{ base: "full", md: "178px" }}
40+
h={{ base: "72px", md: "160px" }}
4141
p={4}
4242
>
4343
{/* Mobile: titolo + chevron */}
@@ -68,7 +68,7 @@ const CourseCard: React.FC<CourseCardProps> = ({ data }) => {
6868

6969
{/* Tag anno */}
7070
<Tag
71-
display={{ base: "none", lg: "flex" }}
71+
display={{ base: "none", md: "flex" }}
7272
position="absolute"
7373
bottom={2}
7474
left="50%"
@@ -107,7 +107,7 @@ const CourseCard: React.FC<CourseCardProps> = ({ data }) => {
107107
w="100%"
108108
h="100%"
109109
bg={overlayBg}
110-
display={{ base: "none", lg: "flex" }}
110+
display={{ base: "none", md: "flex" }}
111111
flexDir="column"
112112
justifyContent="center"
113113
alignItems="center"

components/degree-card/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react"
2-
import { Box, Flex, Text, HStack, useColorModeValue, Image, Link as ChakraLink, Stack } from "@chakra-ui/react"
2+
import { Box, Flex, Text, HStack, useColorModeValue, Link as ChakraLink, Stack } from "@chakra-ui/react"
33
import { motion } from "framer-motion"
4-
import { ArrowUpRight, ChevronRight } from "lucide-react"
4+
import { ArrowRight, ArrowUpRight } from "lucide-react"
55
import { Degree } from "@/types/api"
66
import { useCustomRouter } from "@/hooks/router"
77
import { getDegreeLabel } from "@/utils/degree"
@@ -50,12 +50,13 @@ const DegreeCard: React.FC<DegreeCardProps> = ({ degree, bgColor }) => {
5050
{description}
5151
</Text>
5252
</Stack>
53-
<ChevronRight size={18} strokeWidth={2} />
53+
<Box>
54+
<ArrowRight size={18} strokeWidth={2} />
55+
</Box>
5456
</HStack>
5557

5658
{/* Desktop: icona + titolo + descrizione */}
5759
<Flex direction="column" justify="center" align="flex-start" w="full" h="full" display={{ base: "none", md: "flex" }} p={2}>
58-
{degree.icon && <Image src={degree.icon} alt={degree.name} boxSize="40px" mb={2} objectFit="contain" />}
5960
<Text fontWeight="bold" fontSize="md" noOfLines={3} mb={0.5}>
6061
{degree.name}
6162
</Text>

components/degree-group-card/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ const DegreeGroupCard: React.FC<DegreeGroupCardProps> = ({ degree, group }) => {
3333
position="relative"
3434
_hover={{ shadow: "md" }}
3535
bgGradient={useColorModeValue("linear(to-br, blue.400, blue.500, blue.600)", "linear(to-br, blue.600, blue.700, blue.800)")}
36-
w={{ base: "full", lg: "178px" }}
37-
h={{ base: "72px", lg: "160px" }}
36+
w={{ base: "full", md: "178px" }}
37+
h={{ base: "72px", md: "160px" }}
3838
p={4}
3939
>
4040
{/* Mobile: titolo + chevron */}
41-
<HStack w="full" h="full" align="center" justify="space-between" display={{ base: "flex", lg: "none" }}>
41+
<HStack w="full" h="full" align="center" justify="space-between" display={{ base: "flex", md: "none" }}>
4242
<Text fontWeight="semibold" fontSize="md" noOfLines={1} color={titleColor}>
4343
{t("degreeGroup.main")}
4444
</Text>
@@ -53,7 +53,7 @@ const DegreeGroupCard: React.FC<DegreeGroupCardProps> = ({ degree, group }) => {
5353
w="full"
5454
h="full"
5555
spacing={"2px"}
56-
display={{ base: "none", lg: "flex" }}
56+
display={{ base: "none", md: "flex" }}
5757
p={2}
5858
opacity={1}
5959
transition="opacity 0.3s ease"

components/item-list/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const ItemList = <T,>({
120120
)}
121121

122122
{filteredItems.length > 0 ? (
123-
<Stack direction={itemsDirection ?? { base: "column", sm: "row" }} flexWrap="wrap" justifyContent={{ base: "center", lg: "flex-start" }}>
123+
<Stack direction={itemsDirection ?? { base: "column", md: "row" }} flexWrap="wrap" justifyContent={{ base: "center", lg: "flex-start" }}>
124124
{filteredItems}
125125
</Stack>
126126
) : (

components/search-bar/index.tsx

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
"use client"
21
import { useState, useEffect, useRef } from "react"
32
import { InputGroup, InputLeftElement, Input, VStack, Text, useColorModeValue, InputRightElement, Button, Fade, StackProps } from "@chakra-ui/react"
43
import { Search } from "lucide-react"
@@ -27,6 +26,13 @@ const SearchBar = ({ enableLabel = true, sidebarMode = false, onSearch, focusOnO
2726
const tipColor = useColorModeValue("blue.600", "blue.300")
2827
const labelColor = useColorModeValue("gray.500", "gray.400")
2928

29+
const handleFocus = () => {
30+
inputRef.current?.scrollIntoView({
31+
behavior: "smooth",
32+
block: "center",
33+
})
34+
}
35+
3036
const handleSearch = () => {
3137
if (query.trim()) {
3238
router.push(`/search?q=${query}`)
@@ -36,15 +42,21 @@ const SearchBar = ({ enableLabel = true, sidebarMode = false, onSearch, focusOnO
3642

3743
const handleHighlight = () => {
3844
setHighlight(true)
45+
handleFocus()
3946
setTimeout(() => {
4047
inputRef.current?.focus()
4148
}, 500)
49+
50+
setTimeout(() => {
51+
setHighlight(false)
52+
}, 1500)
4253
}
4354

4455
useEffect(() => {
4556
if (inputRef.current && focusOnOpen) {
4657
setTimeout(() => {
4758
inputRef.current?.focus()
59+
handleFocus()
4860
}, 300)
4961
}
5062
}, [focusOnOpen])
@@ -57,7 +69,7 @@ const SearchBar = ({ enableLabel = true, sidebarMode = false, onSearch, focusOnO
5769
return (
5870
<VStack spacing={3} w="100%" maxW="700px" mx="auto" py={8} {...props} id="search-bar">
5971
{enableLabel && (
60-
<Text fontSize="lg" fontWeight="semibold" color={labelColor} textAlign="center">
72+
<Text fontSize={{ base: "md", md: "lg" }} fontWeight="semibold" color={labelColor} textAlign="center">
6173
{t("searchBar.label")}
6274
</Text>
6375
)}
@@ -73,7 +85,7 @@ const SearchBar = ({ enableLabel = true, sidebarMode = false, onSearch, focusOnO
7385
value={query}
7486
onChange={(e) => setQuery(e.target.value)}
7587
placeholder={!sidebarMode ? t("searchBar.placeholder.main") : t("searchBar.placeholder.sidebar")}
76-
fontSize={!sidebarMode ? "lg" : "sm"}
88+
fontSize={{ base: sidebarMode ? "sm" : "md", md: "md", lg: "lg" }}
7789
bg={bg}
7890
_focus={{ bg: focusBg }}
7991
_placeholder={{ color: placeholderColor }}
@@ -86,11 +98,18 @@ const SearchBar = ({ enableLabel = true, sidebarMode = false, onSearch, focusOnO
8698
onKeyDown={(e) => {
8799
if (e.key === "Enter") handleSearch()
88100
}}
101+
onClick={() => handleFocus()}
89102
/>
90103

91104
{/* Bottone ricerca */}
92105
<InputRightElement w="5.5rem" h="100%">
93-
<Button colorScheme="blue" size={!sidebarMode ? "sm" : "xs"} fontSize={!sidebarMode ? "sm" : "xs"} rounded="md" onClick={handleSearch}>
106+
<Button
107+
colorScheme="blue"
108+
size={sidebarMode ? "xs" : { base: "xs", xs: "sm" }}
109+
fontSize={!sidebarMode ? "sm" : "xs"}
110+
rounded="md"
111+
onClick={handleSearch}
112+
>
94113
{t("searchBar.button")}
95114
</Button>
96115
</InputRightElement>

components/service/card/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default function ServiceCard({ service }: ServiceCardProps) {
2020
<Link href={service.link} target="_blank" rel="noopener noreferrer" prefetch={false}>
2121
<Box
2222
role="group"
23-
w={{ base: "100%", sm: "230px", md: "250px" }}
23+
w={{ base: "100%", sm: "full", md: "250px" }}
2424
h={{ base: "100px", md: "270px" }}
2525
borderWidth="1px"
2626
borderRadius="2xl"

pages/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const Homepage = ({ groups, associations }: HomepageProps) => {
2828

2929
<MainContainer>
3030
<Box pt={12}>
31-
<Heading as="h1" size="4xl" mb={3} textAlign="center">
31+
<Heading as="h1" size={{ base: "3xl", lg: "4xl" }} mb={3} textAlign="center">
3232
{t("networkTagline")}
3333
</Heading>
3434

pages/search/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const SearchPage = ({ query, degrees, groups, associations }: SearchPageProps) =
7171
items={associations}
7272
getItemName={(association) => association.title}
7373
renderItem={(association) => (
74-
<PrivacyButton key={association.id} href={association.invite_link}>
74+
<PrivacyButton key={association.id} href={association.external_url}>
7575
<GroupCard title={association.name[locale]} description={association.description[locale]} category={association.category} />
7676
</PrivacyButton>
7777
)}

styles/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ const config: ThemeConfig = {
77

88
export const theme = extendTheme({
99
config,
10+
breakpoints: {
11+
xs: "22.5rem", // 360px
12+
sm: "30rem", // 480px
13+
md: "48rem", // 768px
14+
lg: "62rem", // 992px
15+
xl: "80rem", // 1280px
16+
"2xl": "96rem", // 1536px
17+
},
1018
styles: {
1119
global: {
1220
"html, body, #__next": {

types/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export interface ExtraGroup extends Group {
7272
user_count: number
7373
button_name: LocalizedField | null
7474
image_url: string | null
75-
external_url: string | null
75+
external_url: string
7676
category: GroupCategory
7777
}
7878

0 commit comments

Comments
 (0)