Skip to content

Commit

Permalink
feat: 학습하기 탭 데이터 클릭 시, 새로운 탭 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
jiohjung98 committed Oct 2, 2024
1 parent 8aea192 commit eec5bcd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
11 changes: 4 additions & 7 deletions src/components/practice/CategoryPracticeItem.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import type { StudyGuidesItem, SubLoadmap } from '@/types/homeComponentsType';
import axios from 'axios';
import React, { useState } from 'react';
import React from 'react';
import { useRouter } from 'next/navigation';

const CategoryPracticeItem = ({ id, title, link }: StudyGuidesItem) => {
const router = useRouter();

const handleLink = () => {
const handleClick = () => {
console.log(link);
if (link) {
router.push(link);
}
window.open(link, '_blank');
};

return (
<div className='pt-5'>
<div className="flex gap-5 items-center cursor-pointer rounded-xl shadow border border-[#eceef2] px-5 py-6" onClick={handleLink}>
<div className="flex gap-5 items-center cursor-pointer rounded-xl shadow border border-[#eceef2] px-5 py-6" onClick={handleClick}>
<div className="flex-1 flex">
<div className="text-gray600 text-body5 sm:text-title1">{title}</div>
</div>
Expand Down
6 changes: 2 additions & 4 deletions src/components/practice/CategorySubloadmapBottomArticle.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import React from 'react';
import { InvestmentGuideProps } from '@/types/homeComponentsType';
import Image from 'next/image';
import { useRouter } from 'next/navigation';

const CategorySubloadmapBottomArticle: React.FC<InvestmentGuideProps> = ({ id, title, description, date, imageLink, link }) => {
const router = useRouter();

const handleClick = () => {
console.log(link);
router.push(link);
window.open(link, '_blank');
};

return (
<div className='w-full pt-5' onClick={handleClick}> {/* 48% 너비로 한 줄에 두 개씩 */}
<div className='w-full pt-5' onClick={handleClick}>
<div className="flex gap-5 items-center cursor-pointer">
<Image
src={imageLink}
Expand Down

0 comments on commit eec5bcd

Please sign in to comment.