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

🔀 :: 기업, 모집의뢰서 리스트 스켈레톤 UI 추가 #21

Merged
merged 6 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion src/app/companies/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import TextFiled from "@/components/common/TextFiled";
import useForm from "@/hook/useForm";
import { useEffect, useState } from "react";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import CompanyCard from "@/components/CompanyCard";
import CompanyCard from "@/components/company/CompanyCard";
import Pagination from "@/components/common/Pagination";

export default function CompanyListPage() {
Expand Down
6 changes: 6 additions & 0 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
@tailwind components;
@tailwind utilities;

@layer components {
.skeltonUi {
@apply bg-[#f7f7f7] relative;
}
}

* {
margin: 0;
padding: 0;
Expand Down
2 changes: 1 addition & 1 deletion src/app/recruitments/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Pagination from "@/components/common/Pagination";
import Filter from "@/components/recruitments/filter";
import RecruitmentsCard from "@/components/RecruitmentsCard";
import RecruitmentsCard from "@/components/recruitments/RecruitmentsCard";

export default function Recruitments() {
return (
Expand Down
4 changes: 2 additions & 2 deletions src/components/CardList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import CompanyCard from "./CompanyCard";
import RecruitmentsCard from "./RecruitmentsCard";
import CompanyCard from "./company/CompanyCard";
import RecruitmentsCard from "./recruitments/RecruitmentsCard";

interface PropsType {
listType: "Company" | "Recruitments" | "BookMark";
Expand Down
6 changes: 3 additions & 3 deletions src/components/Suggestion.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import CompanyCard from "./CompanyCard";
import RecruitmentsCard from "./RecruitmentsCard";

import CompanyCard from "./company/CompanyCard";
import RecruitmentsCard from "./recruitments/RecruitmentsCard";
import SuggestionHeader from "./SuggestionHeader";

interface PropsType {
listType: "Company" | "Recruitments" | "BookMark";
}


export default function Suggestion({ listType }: PropsType) {
return (
<div className="flex flex-col items-start w-full">
Expand Down
23 changes: 23 additions & 0 deletions src/components/common/Skelton/CompanySkelton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import Shimmer from "./Shimmer";

export default function CompaniesSkelton() {
const skeltonArray = [0, 0, 0, 0, 0, 0, 0, 0, 0];

return (
<>
{skeltonArray.map(() => (
<div className="bg-[#ffffff] w-full rounded-[14px]">
<div className="skeltonUi w-full h-[12vw] rounded-[14px] relative overflow-hidden">
<Shimmer />
</div>
<div className="skeltonUi w-full h-8 rounded-[6px] mt-4 relative overflow-hidden">
<Shimmer />
</div>
<div className="skeltonUi w-2/3 h-6 rounded-[6px] mt-2 relative overflow-hidden">
<Shimmer />
</div>
</div>
))}
</>
);
}
7 changes: 7 additions & 0 deletions src/components/common/Skelton/Shimmer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function Shimmer() {
return (
<div className="absolute top-0 left-0 w-full h-full animate-loading">
<div className="w-1/2 h-full bg-[rgba(255,255,255,0.4)] skew-x-[-20deg] shadow-[0_0_30px_30px_rgba(255,255,255,0.05)]" />
</div>
);
}
25 changes: 25 additions & 0 deletions src/components/common/Skelton/SkeltonElement.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Shimmer from "./Shimmer";

export default function RecruitmentSkelton() {
const skeltonArray = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
return (
<>
{skeltonArray.map(() => (
<div className="w-full rounded-[14px] overflow-hidden">
<div className="w-full h-[10vw] skeltonUi relative ">
<Shimmer />
</div>
<div className="w-full h-8 rounded-[6px] skeltonUi mt-4 ">
<Shimmer />
</div>
<div className="w-2/3 h-6 rounded-[6px] skeltonUi mt-2 ">
<Shimmer />
</div>
<div className="w-1/3 h-8 rounded-[20px] skeltonUi mt-2 mb-5 ">
<Shimmer />
</div>
</div>
))}
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,27 @@ import { useSearchParams } from "next/navigation";
import { GetCompaniesList } from "@/apis/companies";
import { useEffect, useState } from "react";
import { CompaniesListType } from "@/apis/companies/type";
import HoverPrefetchLink from "./common/HoverPrefetchLink";
import HoverPrefetchLink from "../common/HoverPrefetchLink";
import { Icon } from "@team-return/design-system";
import CompaniesSkelton from "../common/Skelton/CompanySkelton";

export default function CompanyCard() {
const getParams = useSearchParams();
const [companyList, setCompanyList] = useState<CompaniesListType[]>([]);

const res = GetCompaniesList(getParams.toString());
const compnayList = GetCompaniesList(getParams.toString());

useEffect(() => {
if (res.data?.data.companies) {
if (compnayList.data?.data.companies) {
(() => {
setCompanyList(res.data.data.companies);
setCompanyList(compnayList.data.data.companies);
})();
}
}, [res]);
}, [compnayList]);

return (
<div className="w-full my-[10px] grid grid-cols-2 md:grid-cols-3 gap-[2vw]">
{compnayList.isLoading && <CompaniesSkelton />}
{companyList.map(
({ logo_url, name, take, has_recruitment, id }, index) => (
<HoverPrefetchLink href={`/companies/detail?id=${id}`} key={index}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,24 @@ import React, { useEffect, useState } from "react";
import { useSearchParams } from "next/navigation";
import { RecruitmentsListType } from "@/apis/recruitments/type";
import { GetRecruitmentsList } from "@/apis/recruitments";
import HoverPrefetchLink from "./common/HoverPrefetchLink";
import HoverPrefetchLink from "../common/HoverPrefetchLink";
import RecruitmentSkelton from "../common/Skelton/SkeltonElement";

export default function RecruitmentsCard() {
const getParams = useSearchParams();
const [list, setList] = useState<RecruitmentsListType[]>([]);

const res = GetRecruitmentsList(getParams.toString());
const recruitmentsList = GetRecruitmentsList(getParams.toString());
useEffect(() => {
setList((prev) => res.data?.data.recruitments || prev);
}, [res]);
setList((prev) => recruitmentsList.data?.data.recruitments || prev);
}, [recruitmentsList]);

const tagStyle =
"text-caption leading-caption text-lightBlue font-r border rounded-full border-[#135C9D] py-1 px-2";

return (
<div className="w-full mt-5 grid grid-cols-3 md:grid-cols-4 gap-[1.5vw]">
{recruitmentsList.isLoading && <RecruitmentSkelton />}
{list.map(
(
{
Expand Down
11 changes: 11 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ module.exports = {
content: ["./src/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {
keyframes: {
loading: {
"0%": { transform: "translateX(-150%)" },
"50%": { transform: "translateX(-60%)" },
"80%": { transform: "translateX(150%)" },
},
},
animation: {
loading: "loading 2.5s linear infinite",
},

boxShadow: {
elevaiton: "0px 4px 20px 0px rgba(112, 144, 176, 0.15);",
},
Expand Down