Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design2
/
2016104145
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
cutelee
2020-06-04 11:46:38 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
83ab6b42f5808a336d9dfc50c52e7d050fee8ac9
83ab6b42
1 parent
eb3bb6ea
feat: 파일 로드 기능 구현
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
94 additions
and
2 deletions
project/src/pages/Editor/Editor.scss
project/src/pages/Editor/EditorHeader/EditorHeader.scss
project/src/pages/Editor/EditorHeader/EditorHeader.tsx
project/src/pages/Editor/EditorHeader/index.ts
project/src/pages/Editor/EditorPage.tsx
project/src/pages/Editor/ImageResizer/ImageResizer.tsx
project/src/pages/Editor/ImageResizer/index.ts
project/src/pages/Editor/Editor.scss
View file @
83ab6b4
.my-editor.tui-image-editor-container
{
.tui-image-editor-header
{
min-width
:
initial
!
important
;
display
:
none
;
}
.tui-image-editor-submenu
.tui-image-editor-submenu-item
.tui-image-editor-button
{
...
...
project/src/pages/Editor/EditorHeader/EditorHeader.scss
0 → 100644
View file @
83ab6b4
.my-header
{
position
:
fixed
;
width
:
100%
;
height
:
50px
;
//background: white;
z-index
:
10
;
button
{
float
:
right
;
height
:
35px
;
margin-top
:
20px
;
font-size
:
14px
;
border
:
none
;
border-radius
:
5px
;
margin-right
:
10px
;
cursor
:
pointer
;
}
.file-box
{
.file-box-button
{
//background: white;
}
#input-image-file
{
display
:
none
;
}
}
}
\ No newline at end of file
project/src/pages/Editor/EditorHeader/EditorHeader.tsx
0 → 100644
View file @
83ab6b4
import React, { ChangeEvent } from "react";
import ToastEditor from "tui-image-editor";
import "./EditorHeader.scss";
// TODO: 버튼 노출 규칙 정리하기
// TODO: 다크모드/라이트모드에 따른 버튼 스타일 수정하기
// TODO: 다크모드 토글 버튼을 input 타입 checked로 변경하기
interface EditorHeaderProps {
editor: ToastEditor;
imageLoad: boolean
}
function EditorHeader({ editor, imageLoad }: EditorHeaderProps) {
function onLoadImage(e: ChangeEvent<HTMLInputElement>): void {
const { files } = e.target;
if (files) {
editor.loadImageFromFile(files[0])
.then((result: any) => console.log(result));
}
}
return (
<div className="my-header">
<button>다크모드</button>
{imageLoad ? (
<>
<button>다운로드</button>
<button>저장하기</button>
<button>새 작업</button>
</>
) : (
<>
<span className="file-box">
<button><label htmlFor="input-image-file" className="file-box-button">파일 로드</label></button>
<input type="file" accept="image/*" id="input-image-file" onChange={(e: ChangeEvent<HTMLInputElement>) => onLoadImage(e)}/>
</span>
<button>URL 불러오기</button>
</>
)}
</div>
);
}
export default EditorHeader;
\ No newline at end of file
project/src/pages/Editor/EditorHeader/index.ts
0 → 100644
View file @
83ab6b4
export
{
default
}
from
"./EditorHeader"
;
\ No newline at end of file
project/src/pages/Editor/EditorPage.tsx
View file @
83ab6b4
import React, { useRef, useEffect, useState } from "react";
import ToastEditor from "tui-image-editor";
import EditorHeader from "./EditorHeader";
import { editorOptions } from "utils/editorOptions";
import "tui-image-editor/dist/tui-image-editor.css";
...
...
@@ -24,7 +26,10 @@ function EditorPage() {
}, []);
return (
<div className="my-editor" ref={imageEditorRef} />
<>
<EditorHeader editor={editor} imageLoad={false} />
<div className="my-editor" ref={imageEditorRef} />
</>
);
}
...
...
project/src/pages/Editor/ImageResizer/ImageResizer.tsx
0 → 100644
View file @
83ab6b4
import React from "react";
function ImageResizer() {
return (
<div>이미지 크기 변경</div>
);
}
export default ImageResizer;
\ No newline at end of file
project/src/pages/Editor/ImageResizer/index.ts
0 → 100644
View file @
83ab6b4
export
{
default
}
from
"./ImageResizer"
;
\ No newline at end of file
Please
register
or
login
to post a comment