Skip to content

Modify link in modal #193

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

Merged
merged 2 commits into from
Oct 29, 2023
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
9 changes: 5 additions & 4 deletions src/components/common/template/TemplateBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ export default function TemplateBody(props) {
}

const BodyBox = styled.div`
display: flex,
justify-content: center,
align-items: center,
height: 100%,
display: flex;
justify-content: center;
align-items: center;
height: 100%;
overflow-x: hidden;
overflow-y: auto;
`;

47 changes: 36 additions & 11 deletions src/components/common/template/TemplateTitle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import styled from "styled-components";
import { useRecoilState, useRecoilValue } from "recoil";
import { modalState } from "../../../recoil/commonState";
import GITHUB from "../../../assets/icons/github.svg";
import {
templateContent,
templatePreviewState,
Expand All @@ -10,6 +12,7 @@ import Typography from "@mui/material/Typography";
import Box from "@mui/material/Box";
import Button from "@mui/material/Button";
import LinkIcon from "@mui/icons-material/Link";
import { blue } from "@mui/material/colors";

// props -> type(pr, readme, contributing)
export default function TemplateTitle(props) {
Expand Down Expand Up @@ -52,22 +55,27 @@ export default function TemplateTitle(props) {
alignItems: "center",
}}
>
<Typography
id="PR-desc"
variant="h5"
gutterBottom
color="textSecondary"
m={2}
>
{showValue.length ? showValue[0].subtitle : ""}
<LinkEntireDiv>
{showValue.length && showValue[0].repoUrl ? (
<LinkIcon
<LinkDiv
onClick={() => {
window.open(showValue[0].repoUrl);
}}
></LinkIcon>
>
<GithubImg src={GITHUB} />
<Typography
id="PR-desc"
variant="h5"
gutterBottom
color="textSecondary"
m={1}
>
{showValue[0].subtitle}&nbsp;
<LinkIcon />
</Typography>
</LinkDiv>
) : null}
</Typography>
</LinkEntireDiv>
{showValue.length && showValue[0].id ? (
<Button
variant="contained"
Expand All @@ -83,3 +91,20 @@ export default function TemplateTitle(props) {
</Box>
);
}

const GithubImg = styled.img`
width: 2.3rem;
height: 2.3rem;
`;

const LinkEntireDiv = styled.div`
display: flex;
flex-direction: row;
`;

const LinkDiv = styled.div`
display: flex;
align-items: center;
flex-direction: row;
margin-left: 1.8rem;
`;