diff --git a/src/app/user/profile/page.tsx b/src/app/user/profile/page.tsx index 85a69af..2299868 100644 --- a/src/app/user/profile/page.tsx +++ b/src/app/user/profile/page.tsx @@ -3,7 +3,6 @@ import { HeaderProfile } from '@/features/page-profile/header/header' import { UserIntroductionComponent } from '@/features/page-profile/introduction/UserIntroduction' import { userMock } from '@/features/page-profile/mocks/mock' -import { PlayerProfileSection } from '@/features/page-profile/playerProfileSection/PlayerProfileSection' import { SelectPage } from '@/features/page-profile/select-page/selectPage' import UserDescriptionComponent from '@/features/page-profile/user-description/user-description' import UserPreferenceCategorys from '@/features/page-profile/user-preference/userPreferences' @@ -22,7 +21,7 @@ export default function Profile() { return ( <> -
+
-
+
-
+
{/* mobile */} -
- -
-
- {showElemnt === 'profile' && ( -
- - -
- )} - {showElemnt === 'profile' && } - {showElemnt === 'images' && ( - - - - - )} -
-
+
+ + + {showElemnt === 'profile' && ( + <> + + + + )} + {showElemnt === 'images' && ( + + + + + )}
- +
) } diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsx index ce849b4..39ba630 100644 --- a/src/components/ui/card.tsx +++ b/src/components/ui/card.tsx @@ -7,7 +7,7 @@ const Card = React.forwardRef(
(({ className, ...props }, ref) => (

)) diff --git a/src/features/page-profile/box-image/components/cardWithImage.tsx b/src/features/page-profile/box-image/components/cardWithImage.tsx index ce75ce9..93054e1 100644 --- a/src/features/page-profile/box-image/components/cardWithImage.tsx +++ b/src/features/page-profile/box-image/components/cardWithImage.tsx @@ -8,12 +8,10 @@ interface CardWithImgProps { } export function CardWithImg({ urlImgs }: CardWithImgProps) { return ( - + {urlImgs.map(url => ( diff --git a/src/features/page-profile/introduction/UserIntroduction.tsx b/src/features/page-profile/introduction/UserIntroduction.tsx index fd8f88d..6c6659a 100644 --- a/src/features/page-profile/introduction/UserIntroduction.tsx +++ b/src/features/page-profile/introduction/UserIntroduction.tsx @@ -4,29 +4,13 @@ import { UserIntroductionMock } from './mock' export function UserIntroductionComponent() { return ( - <> - - - {/* */} - {/* */} - {/* */} - - - - + + + + - + ) } diff --git a/src/features/page-profile/introduction/components/UserBio.tsx b/src/features/page-profile/introduction/components/UserBio.tsx index 4196136..3466ce1 100644 --- a/src/features/page-profile/introduction/components/UserBio.tsx +++ b/src/features/page-profile/introduction/components/UserBio.tsx @@ -2,12 +2,14 @@ import { useEffect, useRef, useState } from 'react' import { Button } from '@/components/ui/button' +import { useResize } from '../hooks/useResize' interface UserBioProps { description: string } export function UserBio({ description }: UserBioProps) { + const { width } = useResize() const truncatedTextRef = useRef(null) const [showMore, setShowMore] = useState(false) const [truncateText, setTruncateText] = useState(true) @@ -16,8 +18,10 @@ export function UserBio({ description }: UserBioProps) { const text = truncatedTextRef.current if (text && text.offsetHeight < text.scrollHeight) { setShowMore(true) + } else { + setShowMore(false) } - }, []) + }, [width]) return ( <> @@ -25,19 +29,15 @@ export function UserBio({ description }: UserBioProps) { ref={truncatedTextRef} className={`${ truncateText ? 'truncated-text ' : '' - } text-sm leading-6 text-neutral-500 sm:text-xl`} + } font-notoSans text-sm leading-6 text-neutral-400 sm:text-base`} > - {description.length === 0 || description === '' ? ( - Nenhuma bio cadastrada - ) : ( - description - )} + {description}

{showMore && ( diff --git a/src/features/page-profile/introduction/components/UserSection.tsx b/src/features/page-profile/introduction/components/UserSection.tsx index 208f2be..8d199d3 100644 --- a/src/features/page-profile/introduction/components/UserSection.tsx +++ b/src/features/page-profile/introduction/components/UserSection.tsx @@ -3,5 +3,5 @@ interface UserSectionProps { } export function UserSection({ children }: UserSectionProps) { - return
{children}
+ return
{children}
} diff --git a/src/features/page-profile/introduction/components/UserSectionTitle.tsx b/src/features/page-profile/introduction/components/UserSectionTitle.tsx index c926e28..b742f30 100644 --- a/src/features/page-profile/introduction/components/UserSectionTitle.tsx +++ b/src/features/page-profile/introduction/components/UserSectionTitle.tsx @@ -1,4 +1,3 @@ -import { cva } from 'class-variance-authority' import { cn } from '@/lib/utils' interface UserSectionTitleProps @@ -6,8 +5,15 @@ interface UserSectionTitleProps title: string } -const Title = cva('text-2xl text-neutral-950 h-10 leading-[3rem] sm:h-8 w-full') - export function UserSectionTitle({ title, className }: UserSectionTitleProps) { - return

{title}

+ return ( +

+ {title} +

+ ) } diff --git a/src/features/page-profile/introduction/helpers/resizeDelay.ts b/src/features/page-profile/introduction/helpers/resizeDelay.ts new file mode 100644 index 0000000..087dd8a --- /dev/null +++ b/src/features/page-profile/introduction/helpers/resizeDelay.ts @@ -0,0 +1,12 @@ +export const resizeDelay = (func: () => void, milliseconds?: number) => { + const time = milliseconds || 400 + let timer: number + + return (event: Event): void => { + if (timer) { + clearTimeout(timer) + } + + timer = setTimeout(func, time, event) + } +} diff --git a/src/features/page-profile/introduction/hooks/useResize.tsx b/src/features/page-profile/introduction/hooks/useResize.tsx new file mode 100644 index 0000000..73cc594 --- /dev/null +++ b/src/features/page-profile/introduction/hooks/useResize.tsx @@ -0,0 +1,20 @@ +import { useState, useEffect } from 'react' +import { resizeDelay } from '../helpers/resizeDelay' + +export function useResize() { + const [size, setSize] = useState([window.innerWidth, window.innerHeight]) + + useEffect(() => { + const resize = resizeDelay(() => { + setSize([window.innerWidth, window.innerHeight]) + }) + + window.addEventListener('resize', resize) + + return () => { + window.removeEventListener('resize', resize) + } + }, []) + + return { width: size[0], height: size[1] } +} diff --git a/src/features/page-profile/introduction/introduction.stories.tsx b/src/features/page-profile/introduction/introduction.stories.tsx index aecb754..bcc903d 100644 --- a/src/features/page-profile/introduction/introduction.stories.tsx +++ b/src/features/page-profile/introduction/introduction.stories.tsx @@ -1,5 +1,4 @@ import type { Meta, StoryObj } from '@storybook/react' -import { Separator } from '@/components/ui/separator' import { Card } from '@/components/ui/card' import { UserIntroduction } from '.' import { UserIntroductionMock } from './mock' @@ -19,49 +18,15 @@ export default meta type Story = StoryObj -export const FullIntroduction: Story = { +export const Introduction: Story = { render: () => ( - <> - - - - - - - - - - - - ), -} - -export const MissingIntroduction: Story = { - render: () => ( - - - - - + + + - - + + ), } diff --git a/src/features/page-profile/select-page/selectPage.tsx b/src/features/page-profile/select-page/selectPage.tsx index 4a31d6a..aceb29c 100644 --- a/src/features/page-profile/select-page/selectPage.tsx +++ b/src/features/page-profile/select-page/selectPage.tsx @@ -6,15 +6,15 @@ import { useSelectPage } from './useSelectPage' export function SelectPage() { const { handleSetParams, params, linksWithPath } = useSelectPage() return ( -
    +
      {linksWithPath.map(({ path, text }) => { - const bgBLink = params === text && 'bg-[#FFFFFF]' + const bgBLink = params === text && 'bg-neutral-50' const bgText = - params === text ? 'text-black font-extrabold' : 'text-[#989898] ' + params === text ? 'text-black font-extrabold' : 'text-neutral-400 ' return (
    • +
      {children}
      ) diff --git a/src/features/page-profile/user-description/components/boxWithIcons.tsx b/src/features/page-profile/user-description/components/boxWithIcons.tsx index d448ec1..9dbf084 100644 --- a/src/features/page-profile/user-description/components/boxWithIcons.tsx +++ b/src/features/page-profile/user-description/components/boxWithIcons.tsx @@ -18,8 +18,8 @@ export function BoxWithIcons() { {socialMedia.map(icon => { const IconName = icon return ( - ) })} diff --git a/src/features/page-profile/user-description/components/typograph.tsx b/src/features/page-profile/user-description/components/typograph.tsx index c8c4b6c..97d0ee2 100644 --- a/src/features/page-profile/user-description/components/typograph.tsx +++ b/src/features/page-profile/user-description/components/typograph.tsx @@ -14,7 +14,7 @@ export function Typography({ return ( diff --git a/src/features/page-profile/user-description/user-description.tsx b/src/features/page-profile/user-description/user-description.tsx index 9bf08b5..564be5e 100644 --- a/src/features/page-profile/user-description/user-description.tsx +++ b/src/features/page-profile/user-description/user-description.tsx @@ -19,15 +19,15 @@ export default function UserDescriptionComponent({ return (
      -
      +
      @@ -40,7 +40,7 @@ export default function UserDescriptionComponent({ diff --git a/src/features/page-profile/user-preference/card-category/components/List-categorys.tsx b/src/features/page-profile/user-preference/card-category/components/List-categorys.tsx index ef815d2..190c491 100644 --- a/src/features/page-profile/user-preference/card-category/components/List-categorys.tsx +++ b/src/features/page-profile/user-preference/card-category/components/List-categorys.tsx @@ -1,5 +1,6 @@ 'use client' +import { Card } from '@/components/ui/card' import React from 'react' export default function ListCategorys({ @@ -8,18 +9,18 @@ export default function ListCategorys({ children: React.ReactNode }) { return ( - <> + {Array.from({ length: 1 }, (_, i) => i + 1).map(i => (
      -

      +

      Categoria #{i}

      {children}
      ))} - +
      ) } diff --git a/src/features/page-profile/user-preference/card-category/components/rpgStyle-list.tsx b/src/features/page-profile/user-preference/card-category/components/rpgStyle-list.tsx index d5f5600..5f51ea4 100644 --- a/src/features/page-profile/user-preference/card-category/components/rpgStyle-list.tsx +++ b/src/features/page-profile/user-preference/card-category/components/rpgStyle-list.tsx @@ -1,17 +1,17 @@ 'use client' import React from 'react' -import { - Select, - SelectContent, - SelectGroup, - SelectItem, - SelectLabel, - SelectTrigger, - SelectValue, -} from '@/components/ui/select' -import { cn } from '@/lib/utils' -import { listValues, useRpgStyle } from '../hooks/useRpgStyle' +// import { +// Select, +// SelectContent, +// SelectGroup, +// SelectItem, +// SelectLabel, +// SelectTrigger, +// SelectValue, +// } from '@/components/ui/select' +// import { cn } from '@/lib/utils' +import { useRpgStyle } from '../hooks/useRpgStyle' import useCategory from '../../components/category' import { RPGStyle } from '../../types' import { EnumRPGTypes } from '../hooks/enumRPGType' @@ -21,48 +21,55 @@ export interface RpgStylelistProps { } export function RpgStylelist({ rpgStyle }: RpgStylelistProps) { - const { handleSelectValue, selectValue } = useRpgStyle(rpgStyle) + const { selectValue } = useRpgStyle(rpgStyle) const { getBackgroundColor } = useCategory() return ( -
      -
      +
      + {selectValue.map(({ id, name }) => { const backgroundColor = getBackgroundColor(name as EnumRPGTypes) return ( - + {name} + + // ) })} diff --git a/src/features/page-profile/user-preference/components/Root.tsx b/src/features/page-profile/user-preference/components/Root.tsx index 9dd624b..08b66d0 100644 --- a/src/features/page-profile/user-preference/components/Root.tsx +++ b/src/features/page-profile/user-preference/components/Root.tsx @@ -4,5 +4,5 @@ interface RootProps { children: React.ReactNode } export default function Root({ children }: RootProps) { - return
      {children}
      + return
      {children}
      } diff --git a/src/features/page-profile/user-preference/components/card-achievements.tsx b/src/features/page-profile/user-preference/components/card-achievements.tsx index dfc65ca..b7fe01b 100644 --- a/src/features/page-profile/user-preference/components/card-achievements.tsx +++ b/src/features/page-profile/user-preference/components/card-achievements.tsx @@ -2,25 +2,25 @@ import Image from 'next/image' import React from 'react' interface CardAchievementsProps { - text?: string - src?: string + text: string + src: string } export default function CardAchievements({ text, src }: CardAchievementsProps) { return ( <> {src && ( -
      +
      )} {text && ( -

      +

      {text}

      )} diff --git a/src/features/page-profile/user-preference/components/card-badge.tsx b/src/features/page-profile/user-preference/components/card-badge.tsx index 3e73a81..d5bbd5f 100644 --- a/src/features/page-profile/user-preference/components/card-badge.tsx +++ b/src/features/page-profile/user-preference/components/card-badge.tsx @@ -1,4 +1,5 @@ import React from 'react' +import { Card } from '@/components/ui/card' import CardAchievements from './card-achievements' type Badge = { @@ -13,11 +14,11 @@ interface CardBadgeProps { export default function CardBadge({ badges }: CardBadgeProps) { return (
      -
      + {badges?.map(({ id, icon, name }) => (
      ))} -
      +
      ) } diff --git a/src/features/page-profile/user-preference/components/typograph.tsx b/src/features/page-profile/user-preference/components/typograph.tsx index 5e9d08f..02d69d6 100644 --- a/src/features/page-profile/user-preference/components/typograph.tsx +++ b/src/features/page-profile/user-preference/components/typograph.tsx @@ -14,7 +14,7 @@ export function Typography({ return ( diff --git a/src/features/page-profile/user-preference/userPreferences.tsx b/src/features/page-profile/user-preference/userPreferences.tsx index 11230fa..ee6104a 100644 --- a/src/features/page-profile/user-preference/userPreferences.tsx +++ b/src/features/page-profile/user-preference/userPreferences.tsx @@ -12,21 +12,19 @@ export default function UserPreferenceCategorys({ badges, }: UserPreferenceCompoenteProps) { return ( - - - Estilos preferidos - - - - Conquistas - - - + <> + + + Estilos preferidos + + + + + + Conquistas + + + + ) }