diff --git a/README.md b/README.md index 5f8a8b5..d6f064f 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,10 @@ -
+

- react_epub + react_epub

- # React-Epub-Viewer [![Latest Stable Version](https://img.shields.io/npm/v/react-epub-viewer.svg?style=for-the-badge)](https://www.npmjs.com/package/react-epub-viewer) [![License](https://img.shields.io/badge/license-mit-red.svg?style=for-the-badge)](https://www.npmjs.com/package/react-epub-viewer) diff --git a/package.json b/package.json index cac66e9..1483cb3 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "lib", "README.md" ], - "homepage": "https://altmshfkgudtjr.github.io/react-epub-viewer", "repository": { "type": "git", "url": "https://github.com/altmshfkgudtjr/react-epub-viewer" diff --git a/public/images/logo.png b/public/images/logo.png new file mode 100644 index 0000000..135e59c Binary files /dev/null and b/public/images/logo.png differ diff --git a/public/images/reactEpubIcon.png b/public/images/reactEpubIcon.png deleted file mode 100644 index 1ba02c0..0000000 Binary files a/public/images/reactEpubIcon.png and /dev/null differ diff --git a/src/components/footer/Item.tsx b/src/components/footer/Item.tsx index d6583fa..cbd7237 100644 --- a/src/components/footer/Item.tsx +++ b/src/components/footer/Item.tsx @@ -16,8 +16,15 @@ const Container = styled.div` display: flex; align-items: center; justify-content: center; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + & > span { color: ${palette.gray4}; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } `; diff --git a/src/components/header/Layout.tsx b/src/components/header/Layout.tsx index f81c21e..f66a36e 100644 --- a/src/components/header/Layout.tsx +++ b/src/components/header/Layout.tsx @@ -9,8 +9,7 @@ const Layout = styled.div` align-items: center; justify-content: center; width: 100%; - height: 54px; - background-color: ${palette.white}; + height: 64px; z-index: ${zIndex.header}; `; diff --git a/src/components/header/Logo.tsx b/src/components/header/Logo.tsx index fd74471..cb902ff 100644 --- a/src/components/header/Logo.tsx +++ b/src/components/header/Logo.tsx @@ -2,11 +2,12 @@ import styled from 'styled-components' // lib import * as styles from 'lib/styles/styles' import palette from 'lib/styles/palette' +import { mediaQuery } from 'lib/styles/media' const Logo = () => { return ( - Logo + Logo ); } @@ -18,18 +19,22 @@ const Wrapper = styled.a` outline: none; margin-left: 16px; background-color: rgba(0,0,0,0); - transition: .3s ${styles.transition}; + transition: .2s ${styles.transition}; border-radius: 8px; padding: 4px 8px; cursor: pointer; + ${mediaQuery(700)} { + display: none; + } + &:focus, &:hover { - background-color: ${palette.blue1}; + background-color: ${palette.blue0}; } `; const Img = styled.img` - height: 32px; + height: 44px; `; export default Logo \ No newline at end of file diff --git a/src/components/learning/SortedBtn.tsx b/src/components/learning/SortedBtn.tsx deleted file mode 100644 index aa4dc5d..0000000 --- a/src/components/learning/SortedBtn.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import styled from 'styled-components' -// lib -import * as styles from 'lib/styles/styles' -import palette from 'lib/styles/palette' - -const SortedBtn = ({ text, isSelected, onClick }: Props) => { - return {text}; -} - -const Btn = styled.button<{isSelected: boolean}>` - height: 20px; - line-height: 20px; - font-size: 14px; - cursor: pointer; - text-align: center; - margin-left: 16px; - color: ${({isSelected}) => isSelected - ? palette.blue3 - : palette.gray4 - }; - transition: .2s ${styles.transition}; - - &:hover { - color: ${palette.blue3}; - } -`; - -interface Props { - text: string; - isSelected: boolean; - onClick: () => void; -} - -export default SortedBtn \ No newline at end of file diff --git a/src/components/learning/SortedBtnWrapper.tsx b/src/components/learning/SortedBtnWrapper.tsx deleted file mode 100644 index 23f2764..0000000 --- a/src/components/learning/SortedBtnWrapper.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import styled from 'styled-components' - -const SortedBtnWrapper = styled.div` - display: flex; - align-items: center; - justify-content: flex-end; - padding: 0 24px 24px 24px; -`; - -export default SortedBtnWrapper \ No newline at end of file diff --git a/src/components/nav/NavItem.tsx b/src/components/nav/NavItem.tsx index ed00999..632b7ac 100644 --- a/src/components/nav/NavItem.tsx +++ b/src/components/nav/NavItem.tsx @@ -33,6 +33,10 @@ const Content = styled.button` margin-left: 12px; } } + + &:last-child { + margin-bottom: 32px; + } `; interface Props { diff --git a/src/components/learning/Layout.tsx b/src/components/note/Layout.tsx similarity index 100% rename from src/components/learning/Layout.tsx rename to src/components/note/Layout.tsx diff --git a/src/components/learning/highlight/PageNum.tsx b/src/components/note/highlight/PageNum.tsx similarity index 100% rename from src/components/learning/highlight/PageNum.tsx rename to src/components/note/highlight/PageNum.tsx diff --git a/src/components/learning/highlight/Post.tsx b/src/components/note/highlight/Post.tsx similarity index 100% rename from src/components/learning/highlight/Post.tsx rename to src/components/note/highlight/Post.tsx diff --git a/src/components/learning/highlight/Title.tsx b/src/components/note/highlight/Title.tsx similarity index 100% rename from src/components/learning/highlight/Title.tsx rename to src/components/note/highlight/Title.tsx diff --git a/src/components/learning/highlight/Wrapper.tsx b/src/components/note/highlight/Wrapper.tsx similarity index 100% rename from src/components/learning/highlight/Wrapper.tsx rename to src/components/note/highlight/Wrapper.tsx diff --git a/src/components/header/ControlIconBtn.tsx b/src/components/option/ControlIconBtn.tsx similarity index 100% rename from src/components/header/ControlIconBtn.tsx rename to src/components/option/ControlIconBtn.tsx diff --git a/src/components/option/ControlIconBtnWrapper.tsx b/src/components/option/ControlIconBtnWrapper.tsx new file mode 100644 index 0000000..b642f7c --- /dev/null +++ b/src/components/option/ControlIconBtnWrapper.tsx @@ -0,0 +1,29 @@ +import styled from 'styled-components' +// components +import OptionWrapper from 'components/option/OptionWrapper' +import OptionTitle from 'components/option/OptionTitle' + +const ControlIconBtnWrapper = ({ title, children }: Props) => { + return ( + + {title} + + {children} + + + ); +} + +const BtnWrapper = styled.div` + display: flex; + align-items: center; + justify-content: space-around; + padding: 8px 0; +`; + +interface Props { + title: string; + children: any[] +} + +export default ControlIconBtnWrapper \ No newline at end of file diff --git a/src/components/sideMenu/Wrapper.tsx b/src/components/sideMenu/Wrapper.tsx index 29acca3..f230cee 100644 --- a/src/components/sideMenu/Wrapper.tsx +++ b/src/components/sideMenu/Wrapper.tsx @@ -24,6 +24,7 @@ const Container = styled.div` flex-direction: column; position: fixed; width: 340px; + max-width: 95vw; height: 100vh; top: 0; right: 0; @@ -33,9 +34,9 @@ const Container = styled.div` border-radius: 16px 0 0 16px; transform: ${({ show }: { show: boolean }) => show ? `translateX(0px) scale(1)` - : `translateX(420px) scale(.8)` + : `translateX(420px) scale(.9)` }; - transition: .3s ${styles.transition}; + transition: .4s ${styles.transition}; overflow-y: auto; ${styles.scrollbar()}; `; @@ -46,7 +47,7 @@ const Header = styled.div` display: flex; align-items: center; justify-content: space-between; - padding-top: 30px; + padding-top: 4px; & > span { padding-left: 24px; diff --git a/src/containers/Header.tsx b/src/containers/Header.tsx index 7b6f224..ef43c63 100644 --- a/src/containers/Header.tsx +++ b/src/containers/Header.tsx @@ -1,109 +1,24 @@ -import { useState } from 'react' // components import Wrapper from 'components/header/Wrapper' import Layout, { AutoLayout } from 'components/header/Layout' import Logo from 'components/header/Logo' import ControlBtn from 'components/header/ControlBtn' -import ControlIconBtn from 'components/header/ControlIconBtn' -import VerticalLine from 'components/header/VerticalLine' -// types -import { BookOption } from 'types/book' - -const Header = ({ - title, - bookOption, +const Header = ({ onNavToggle, onOptionToggle, - onLearningToggle, - onBookOptionChange + onLearningToggle }: Props) => { - const [isScrollHorizontal, setIsScrollHorizontal] = useState(true); - const [viewType, setViewType] = useState({ - active: true, - spread: true - }); - - - /** - * Select view direction - * @param type Direction - */ - const onClickDirection = (type: "Horizontal" | "Vertical") => { - if (type === "Horizontal") { - setIsScrollHorizontal(true); - setViewType({ ...viewType, active: true }); - onBookOptionChange({ - ...bookOption, - flow: "paginated" - }); - } else { - setIsScrollHorizontal(false); - setViewType({ ...viewType, active: false }); - onBookOptionChange({ - ...bookOption, - flow: "scrolled-doc" - }); - } - } - - /** - * Select isSpread - * @param isSpread Whether spread view - */ - const onClickViewType = (isSpread: boolean) => { - if (isSpread) { - setViewType({ ...viewType, spread: true }); - onBookOptionChange({ - ...bookOption, - spread: "auto" - }); - } else { - setViewType({ ...viewType, spread: false }); - onBookOptionChange({ - ...bookOption, - spread: "none" - }); - } - } - - return ( +
-
- -
- onClickDirection("Horizontal")} /> - onClickDirection("Vertical")} /> - - - - onClickViewType(true)} /> - onClickViewType(false)} /> -
@@ -111,17 +26,9 @@ const Header = ({ } interface Props { - title: string; - bookOption: BookOption; onNavToggle: (value?: boolean) => void; onOptionToggle: (value?: boolean) => void; onLearningToggle: (value?: boolean) => void; - onBookOptionChange: (bookOption: BookOption) => void; -} - -type ViewType = { - active: boolean, - spread: boolean } export default Header \ No newline at end of file diff --git a/src/containers/Reader.tsx b/src/containers/Reader.tsx index a0cf92a..a10a621 100644 --- a/src/containers/Reader.tsx +++ b/src/containers/Reader.tsx @@ -32,7 +32,6 @@ import Toc from 'types/toc' const Reader = ({ url, loadingView }: Props) => { const dispatch = useDispatch(); - const book = useSelector(state => state.book.book); const currentLocation = useSelector(state => state.book.currentLocation); const viewerRef = useRef(null); @@ -138,12 +137,9 @@ const Reader = ({ url, loadingView }: Props) => { return (<>
{