Skip to content

Commit

Permalink
Merge pull request #18 from loxygenK/feat/contact-page
Browse files Browse the repository at this point in the history
  • Loading branch information
loxygenK authored Nov 21, 2021
2 parents bf116d9 + 70ea047 commit 71b7019
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 7 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/api/graphql/autogen
Empty file.
1 change: 0 additions & 1 deletion src/comps/shared/AwaitFetch.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";

import styles from "./AwaitFetch.module.scss";
import { Emoji } from "./Emoji";

export type AwaitFetchProps<T> = {
Expand Down
3 changes: 3 additions & 0 deletions src/pages/about/atoms/Contact.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.contact {
font-weight: 700;
}
19 changes: 19 additions & 0 deletions src/pages/about/atoms/Contact.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from "react";

import styles from "./Contact.module.scss";

export type ContactProps = {
service: string;
url: string;
identifier: string;
};
export const Contact: React.VFC<ContactProps> = (props) => (
<a
href={props.url}
target="_blank"
rel="noreferrer"
className={styles.contact}
>
{props.service}
</a>
);
13 changes: 9 additions & 4 deletions src/pages/about/controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { gql, useQuery } from "@apollo/client";
import { Basic } from "~/api/graphql/autogen/scheme";
import { gql, QueryResult, useQuery } from "@apollo/client";
import { Basic, Contact } from "~/api/graphql/autogen/scheme";

const fetchBasic = gql`
query FetchBasic {
Expand All @@ -15,9 +15,14 @@ const fetchBasic = gql`
}
age
}
contacts {
service
identifier
url
}
}
`;
type FetchIntroductionResponse = { basic: Basic };
type FetchIntroductionResponse = { basic: Basic; contacts: Contact[] };

export const useBasicAPI = () =>
export const useBasicAPI = (): QueryResult<FetchIntroductionResponse> =>
useQuery<FetchIntroductionResponse>(fetchBasic);
4 changes: 4 additions & 0 deletions src/pages/about/organisms/Introduction.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@
gap: 0.5em;
}

.contacts {
display: flex;
gap: 0.5em;
}
6 changes: 6 additions & 0 deletions src/pages/about/organisms/Introduction.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { AwaitFetch } from "~/comps/shared/AwaitFetch";
import { Affiliation } from "../atoms/Affiriation";
import { Contact } from "../atoms/Contact";
import { useBasicAPI } from "../controller";

import styles from "./Introduction.module.scss";
Expand All @@ -18,6 +19,11 @@ export const Introduction = () => {
{data.basic.name.aka.join(" / ")}
</span>
</div>
<div className={styles.contacts}>
{data.contacts.map((c, i) => (
<Contact {...c} key={i} />
))}
</div>
<div className={styles.affiriation}>
{data.basic.affiliation.map((a, key) => (
<Affiliation {...a} key={key} />
Expand Down
1 change: 0 additions & 1 deletion src/pages/skills/atoms/Skill.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";
import { SkilledLevel } from "~/api/graphql/autogen/scheme";
import { Emoji } from "~/comps/shared/Emoji";
import { combineClassName } from "~/utils/combineClassName";

import styles from "./Skill.module.scss";

Expand Down
1 change: 0 additions & 1 deletion src/pages/works/atoms/Work.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react";
import { Link } from "react-router-dom";
import { Status, Work as WorkEntity } from "~/api/graphql/autogen/scheme";

import styles from "./Work.module.scss";
Expand Down

0 comments on commit 71b7019

Please # to comment.