Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Math.floor()
- sort()
- getday()
- indexOf()
- toUpperCase()
- Math.sqrt()
- React
- Number()
- includes()
- charAt()
- isNaN()
- 소수점 올림내림
- useRef()
- useState()
- map()
- slice()
- useEffect()
- substring()
- 교집합
- filter()
- 3진수
- 항해99솔직후기 #항해99장점 #항해99단점 #부트캠프추천
- reat if문
- setDate
- Eventlitener
- repeat()
- 차집합
- new Date()
- parseInt()
- jsx반복문
Archives
- Today
- Total
개발자로 전향중
react 표 만들고 싶을 때 참고 본문
import React, { useEffect, useCallback, useState } from "react";
import styled from "styled-components";
import BackgroundImg from "../assests/image/DIP01.png";
import axios from "axios";
import { getCookie, setCookie } from "../utils/cookie";
const Main = () => {
const [userName, setUserName] = useState<string>("");
useEffect(() => {
axios.get("http://dip.kia.co.kr:8000/sso/autologin", {}).then((res) => {
const obj = JSON.parse(res.data);
console.log(obj.Name);
//네임이 빈값이 아니면 쿠키 저장 아니면 다른 페이지 이동
if (obj.Name !== "CannotAceess" && obj.SSO_ID !== "CannotAceess") {
setCookie(obj.Name, obj.SSO_ID);
setUserName(obj.Name);
} else {
return alert("오토웨이 페이지 이동!");
}
});
}, [userName]);
//클릭시 설치 팝업
function RunProgram() {
window.open("DIP:\\", "_self");
}
const DIPClick = () => {
RunProgram();
};
return (
<Container>
<MainDiv>
<Header>환영합니다</Header>
<ExcuteSection>
<Table>
<tr>
<td className="userInfo">
<p className="userInfo--text">이름</p>
</td>
<td className="userInfo2">
<p className="userInfo--text2">PPRK</p>
</td>
</tr>
<tr>
<td className="userInfo">
<p className="userInfo--text">소속</p>
</td>
<td className="userInfo2">
<p className="userInfo--text2">디자인팀</p>
</td>
</tr>
<tr>
<td className="userInfo">
<p className="userInfo--text">직위</p>
</td>
<td className="userInfo2">
<p className="userInfo--text2">사원</p>
</td>
</tr>
</Table>
<Button onClick={DIPClick}>DIP 실행하기</Button>
</ExcuteSection>
</MainDiv>
</Container>
);
};
export default Main;
const Container = styled.div`
width: 100%;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: url(${BackgroundImg}) no-repeat center center;
background-size: cover;
`;
const MainDiv = styled.main`
width: 473px;
height: 353px;
border: 1px solid #def9ff;
`;
const Header = styled.header`
width: 100%;
height: 50px;
display: flex;
justify-content: center;
align-items: center;
background-color: #7db6c9;
font: normal normal normal 23px HDharmony M;
letter-spacing: 0px;
color: #ffffff;
`;
const ExcuteSection = styled.section`
width: 100%;
height: 303px;
background-color: rgb(42, 55, 69, 0.7);
box-sizing: border-box;
padding: 20px;
`;
const Table = styled.table`
width: 100%;
height: 180px;
margin: auto;
border-collapse: collapse;
td {
border-bottom: 2px solid #78979b;
}
.userInfo {
width: 30%;
border-right: 2px solid #78979b;
.userInfo--text {
display: flex;
justify-content: center;
font: normal normal normal 18px HDharmony M;
letter-spacing: 0px;
color: #ffffff;
}
}
.userInfo2 {
width: 70%;
.userInfo--text2 {
margin-left: 20px;
font: normal normal normal 18px HDharmony M;
letter-spacing: 0px;
color: #ffffff;
}
}
`;
const Button = styled.div`
display: flex;
width: 100%;
height: 50px;
margin-top: 20px;
border: 1px solid #fff;
font: normal normal normal 18px HDharmony M;
letter-spacing: 0px;
color: #ffffff;
background: #5c8ca8;
justify-content: center;
align-items: center;
`;
'React' 카테고리의 다른 글
Redux-Toolkit TypeScript 여러개의 객체를 배열 추가할때 (0) | 2022.11.24 |
---|---|
React 체크박스 여러개 체크할 때 체크 value (0) | 2022.11.02 |
react hook form 사용 예시 and 자동 전화번호 하이픈 (1) | 2022.10.06 |
UseCountup 자동으로 숫자올라가기 (0) | 2022.10.06 |
Swiper react/typescript 화살표 커스텀 및 slider 인덱스 (0) | 2022.09.14 |