Skip to content
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

feat: home-yls #220

Merged
merged 7 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/home/components/QuickLink/QuickLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react';

import { LogClick } from '@yourssu/logging-system-react';

import { useGetUserData } from '@/home/hooks/useGetUserData.ts';

interface QuickLinkProps {
icon: { icon: string; link: string };
order: string;
children: React.ReactElement;
}

export const QuickLink = ({ icon, order, children }: QuickLinkProps) => {
const { data: currentUser } = useGetUserData();
const userId = currentUser?.email || '';

const logParams = {
userId,
version: 1,
event: {
name: 'quickLinkItemClicked',
screen: 'Home',
params: {
link: icon.link,
order,
},
},
};

return <LogClick params={logParams}>{children}</LogClick>;
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import BlogIcon from '@/assets/home/blog.svg';
import BrunchIcon from '@/assets/home/brunch.svg';
import InstagramIcon from '@/assets/home/instagram.svg';
import PpussungIcon from '@/assets/home/ppussung.svg';
import { QuickLink } from '@/home/components/QuickLink/QuickLink.tsx';

import { StyledIcon, StyledIconContainer, StyledLine } from './SocialNetworkService.style';

Expand All @@ -23,7 +24,9 @@ export const SocialNetworkService = () => {
<StyledIconContainer>
{ICON_LIST.map((icon, index) => (
<React.Fragment key={icon.icon}>
<StyledIcon to={icon.link} $image={icon.icon} />
<QuickLink icon={icon} order={String(index + 1)}>
<StyledIcon to={icon.link} $image={icon.icon} />
</QuickLink>
{ICON_LIST.length !== index + 1 && <StyledLine />}
</React.Fragment>
))}
Expand Down