-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
M1-TOP Page / UI #9
Changes from 4 commits
055dc5d
6724a8d
370a5f0
ef5235f
9afb362
5d4e5c9
f7e13af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ yarn-error.log* | |
|
||
# local env files | ||
.env*.local | ||
.env | ||
|
||
# vercel | ||
.vercel | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20.8.0 | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { InputSearch } from './input-search' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { | ||
Input as ChakraInput, | ||
InputProps as ChakraInputProps, | ||
InputGroup, | ||
InputRightElement, | ||
IconButton, | ||
forwardRef, | ||
useColorModeValue | ||
} from '@chakra-ui/react' | ||
import { FiSearch } from 'react-icons/fi' | ||
|
||
export const InputSearch = forwardRef<ChakraInputProps, 'input'>( | ||
({ ...props }, ref) => { | ||
const bgColor = useColorModeValue('white', 'gray.700') | ||
const borderColor = useColorModeValue('primary.700', 'gray.500') | ||
|
||
return ( | ||
<InputGroup minW={{ base: '100%', md: '23.75rem' }}> | ||
<ChakraInput | ||
ref={ref} | ||
{...props} | ||
borderColor={borderColor} | ||
placeholder="places, dates, tags..." | ||
focusBorderColor={'primary.600'} | ||
bgColor={bgColor} | ||
_placeholder={{ color: 'gray.400' }} | ||
/> | ||
<InputRightElement> | ||
<IconButton | ||
aria-label="Search Trip" | ||
variant="unstyled" | ||
type="submit" | ||
color="primary.700" | ||
> | ||
<FiSearch size="24px" /> | ||
</IconButton> | ||
</InputRightElement> | ||
</InputGroup> | ||
) | ||
} | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { useIsMobile } from './useIsMobile' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { useBreakpointValue } from '@chakra-ui/react' | ||
|
||
type BreakpointType = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | ||
|
||
export const useIsMobile = (breakpoint: BreakpointType = 'md') => { | ||
return { isMobile: useBreakpointValue({ base: true, [breakpoint]: false }) } | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I did it on purpose! I thought it's better to make the width as 100% since the other components are width 100% and I wanted to arrange it in same line. I could do two columns for iPad instead but I just did one column as SP size. Maybe it's better? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @SachiGoto |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export const Button = { | ||
// Override the default dark mode theme | ||
variants: { | ||
solid: ({ colorMode }: { colorMode: 'dark' | 'light' }) => ({ | ||
bg: colorMode === 'dark' ? 'primary.500' : 'primary.500' | ||
}), | ||
outline: ({ colorMode }: { colorMode: 'dark' | 'light' }) => ({ | ||
color: colorMode === 'dark' ? 'primary.700' : 'primary.700' | ||
}) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { TripCard } from './trip-card' | ||
export { TripSearch } from './trip-search' | ||
export { TripSort } from './trip-sort' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import { Link as NextLink } from '@chakra-ui/next-js' | ||
import { | ||
Card, | ||
CardBody, | ||
Heading, | ||
Flex, | ||
Image, | ||
Box, | ||
useColorModeValue | ||
} from '@chakra-ui/react' | ||
import { MdAccountCircle } from 'react-icons/md' | ||
|
||
type TripCardProps = { | ||
data: { | ||
id: number | ||
title: string | ||
image_storage_object_id: string | ||
date_from: string | ||
date_to: string | ||
share: { id: string; image: string }[] | ||
} | ||
} | ||
|
||
export const TripCard = ({ data }: TripCardProps) => { | ||
const bgColorSp = useColorModeValue('white', 'gray.800') | ||
const bgColorPc = useColorModeValue('white', 'gray.700') | ||
const borderColor = useColorModeValue('gray.200', 'gray.600') | ||
|
||
return ( | ||
<Card | ||
as={NextLink} | ||
href={`/trip/${data.id}`} | ||
role={'group'} | ||
maxW={{ base: '100%', lg: '360px' }} | ||
pb={{ base: '12px', md: '0px' }} | ||
flexDir={{ base: 'row', md: 'column' }} | ||
gap={{ base: '14px', md: '0px' }} | ||
justify="space-between" | ||
w="100%" | ||
borderRadius={{ base: 'none', md: 'lg' }} | ||
boxShadow={{ base: 'none', md: 'base' }} | ||
borderBottom={{ base: '1px', md: 'none' }} | ||
borderColor={{ base: borderColor, md: 'none' }} | ||
bgColor={{ base: bgColorSp, md: bgColorPc }} | ||
align="center" | ||
_hover={{ | ||
textDecoration: 'none' | ||
}} | ||
> | ||
<Box overflow="hidden" w={{ base: '', md: '100%' }}> | ||
<Image | ||
src={data.image_storage_object_id} | ||
alt={`Picture of ${data.title}`} | ||
w={{ base: '150px', md: '100%' }} | ||
h={{ base: '100px', md: '240px' }} | ||
objectFit="cover" | ||
_groupHover={{ | ||
transform: 'scale(1.1)', | ||
transition: 'all 0.3s' | ||
}} | ||
/> | ||
</Box> | ||
<CardBody | ||
display="flex" | ||
flexDir="column" | ||
justifyContent="space-between" | ||
overflow="hidden" | ||
w="100%" | ||
gap="8px" | ||
py={{ base: '0', md: '12px' }} | ||
px={{ base: '0', md: '8px' }} | ||
> | ||
<Heading | ||
fontSize={{ base: 'lg', md: 'xl' }} | ||
color="primary.700" | ||
display={'-webkit-box'} | ||
overflow={'hidden'} | ||
sx={{ | ||
WebkitBoxOrient: 'vertical', | ||
WebkitLineClamp: '2' | ||
}} | ||
_groupHover={{ | ||
color: 'primary.600' | ||
}} | ||
> | ||
{data.title} | ||
</Heading> | ||
<Flex gap="8px" color="gray.400"> | ||
<Box | ||
w={{ base: '26px', md: '38px' }} | ||
h={{ base: '26px', md: '38px' }} | ||
> | ||
<MdAccountCircle size="100%" /> | ||
</Box> | ||
<Box | ||
w={{ base: '26px', md: '38px' }} | ||
h={{ base: '26px', md: '38px' }} | ||
> | ||
<MdAccountCircle size="100%" /> | ||
</Box> | ||
</Flex> | ||
<Flex fontSize={{ base: 'sm', md: 'md' }}> | ||
{data.date_from} - {data.date_to} | ||
</Flex> | ||
</CardBody> | ||
</Card> | ||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { InputSearch } from '@/components/input' | ||
|
||
export const TripSearch = () => { | ||
return <InputSearch /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This component has meaning. I will add more to this component in next PR |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Menu, MenuButton, MenuList, MenuItem, Flex } from '@chakra-ui/react' | ||
import { MdOutlineSort, MdArrowDropDown } from 'react-icons/md' | ||
import { useIsMobile } from '@/hooks' | ||
|
||
export const TripSort = () => { | ||
const { isMobile } = useIsMobile() | ||
|
||
return ( | ||
<Menu> | ||
<MenuButton | ||
borderWidth={{ base: 'none', md: '1px' }} | ||
borderColor="gray.300" | ||
p={{ base: '0px', md: '8px' }} | ||
> | ||
{isMobile ? ( | ||
<Flex as="span" color="primary.700"> | ||
<MdOutlineSort size="40px" /> | ||
</Flex> | ||
) : ( | ||
<Flex | ||
as="span" | ||
align="center" | ||
gap="8px" | ||
fontWeight={700} | ||
sx={{ | ||
svg: { | ||
_last: { | ||
color: 'gray.400' | ||
} | ||
} | ||
}} | ||
> | ||
<MdOutlineSort size="18px" /> | ||
Sort By | ||
<MdArrowDropDown size="30px" /> | ||
</Flex> | ||
)} | ||
</MenuButton> | ||
|
||
<MenuList> | ||
<MenuItem>Date</MenuItem> | ||
<MenuItem>Created</MenuItem> | ||
<MenuItem>Title</MenuItem> | ||
</MenuList> | ||
</Menu> | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we need it so I added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, but different version ?
frontend/.github/workflows/lint.yml
Line 17 in 95cbd38
I'd say both have to be same version.
Probably 20.8.0 would be better, due to Next.js version 14's node version prerequisites.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Yo-mah-Ya
Thank you! I changed it
f7e13af