diff --git a/README.md b/README.md
index 5f8a8b5..d6f064f 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,10 @@
-
+
-
+
-
# 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 (
-
+
);
}
@@ -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 (<>
{
diff --git a/src/containers/menu/Note.tsx b/src/containers/menu/Note.tsx
index c5bd985..cde47cb 100644
--- a/src/containers/menu/Note.tsx
+++ b/src/containers/menu/Note.tsx
@@ -4,9 +4,7 @@ import { useSelector } from 'react-redux'
import Highlight from 'containers/menu/commons/Highlight'
// components
import Wrapper from 'components/sideMenu/Wrapper'
-import LearningLayout from 'components/learning/Layout'
-import SortedBtnWrapper from 'components/learning/SortedBtnWrapper'
-import SortedBtn from 'components/learning/SortedBtn'
+import LearningLayout from 'components/note/Layout'
import MenuEmpty from 'components/sideMenu/MenuEmpty'
// types
import { RootState } from 'slices'
@@ -22,36 +20,20 @@ const Note = ({
viewerRef
}: Props, ref: any) => {
const highlights = useSelector(state => state.book.highlights);
-
- const [sorted, setSorted] = useState("CART");
const [highlightList, setHighlightList] = useState([]);
-
- /**
- * Select sort type
- * @param type Viewed or Created
- */
- const onSortedClick = (type: Sorted) => setSorted(type);
/** Set highlight contents */
useEffect(() => {
- const sortedKey = sorted === "LOOK"
- ? "accessTime"
- : "createTime";
-
- const highlightList = highlights.slice().sort(function (a, b) {
- return new Date(b[sortedKey]).getTime() - new Date(a[sortedKey]).getTime();
- });
- const Items = highlightList.map(h =>
+ const Items = highlights.map(h =>
);
setHighlightList(Items);
}, [
viewerRef,
- sorted,
highlights,
onClickHighlight,
emitEvent,
@@ -65,19 +47,6 @@ const Note = ({
onClose={onToggle}
ref={ref} >
-
- onSortedClick("LOOK")}
- />
- onSortedClick("CART")}
- />
-
-
{highlightList.length > 0
? highlightList
:
diff --git a/src/containers/menu/Option.tsx b/src/containers/menu/Option.tsx
index adfd58e..5cef77b 100644
--- a/src/containers/menu/Option.tsx
+++ b/src/containers/menu/Option.tsx
@@ -5,23 +5,33 @@ import Wrapper from 'components/sideMenu/Wrapper'
import OptionLayout from 'components/option/Layout'
import OptionDropdown from 'components/option/Dropdown'
import OptionSlider from 'components/option/Slider'
+import ControlIconBtnWrapper from 'components/option/ControlIconBtnWrapper'
+import ControlIconBtn from 'components/option/ControlIconBtn'
// types
import { BookStyle, BookFontFamily, BookFlow } from 'types/book'
import { MenuControl } from 'lib/hooks/useMenu'
+import { BookOption } from 'types/book'
const Option = ({
control,
bookStyle,
+ bookOption,
bookFlow,
onToggle,
emitEvent,
- onBookStyleChange
+ onBookStyleChange,
+ onBookOptionChange
}: Props, ref: any) => {
const [fontFamily, setFontFamily] = useState(bookStyle.fontFamily);
const [fontSize, setFontSize] = useState(bookStyle.fontSize);
const [lineHeight, setLineHeight] = useState(bookStyle.lineHeight);
const [marginHorizontal, setMarginHorizontal] = useState(bookStyle.marginHorizontal);
const [marginVertical, setMarginVertical] = useState(bookStyle.marginVertical);
+ const [isScrollHorizontal, setIsScrollHorizontal] = useState(true);
+ const [viewType, setViewType] = useState({
+ active: true,
+ spread: true
+ });
/** Change font family */
@@ -48,6 +58,48 @@ const Option = ({
}
}
+ /**
+ * 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"
+ });
+ }
+ }
+
/* Save userdata */
// TODO Fix the infinite re-rendering issue, when inlcude `onBookStyleChange` to dependencies array.
@@ -83,6 +135,30 @@ const Option = ({
onClose={onToggle}
ref={ref}>
+
+ onClickDirection("Horizontal")} />
+ onClickDirection("Vertical")} />
+
+
+ onClickViewType(true)} />
+ onClickViewType(false)} />
+
void;
emitEvent: () => void;
onBookStyleChange: (bookStyle: BookStyle) => void;
+ onBookOptionChange: (bookOption: BookOption) => void;
}
type SliderType = "FontSize"
@@ -134,4 +212,9 @@ type SliderType = "FontSize"
| "MarginHorizontal"
| "MarginVertical";
+type ViewType = {
+ active: boolean,
+ spread: boolean
+}
+
export default React.forwardRef(Option)
\ No newline at end of file
diff --git a/src/containers/menu/commons/Highlight.tsx b/src/containers/menu/commons/Highlight.tsx
index 7d9ce5b..27e9f65 100644
--- a/src/containers/menu/commons/Highlight.tsx
+++ b/src/containers/menu/commons/Highlight.tsx
@@ -1,9 +1,9 @@
import { useDispatch } from 'react-redux'
// components
-import Wrapper from 'components/learning/highlight/Wrapper'
-import Title from 'components/learning/highlight/Title'
-import Post from 'components/learning/highlight/Post'
-import PageNum from 'components/learning/highlight/PageNum'
+import Wrapper from 'components/note/highlight/Wrapper'
+import Title from 'components/note/highlight/Title'
+import Post from 'components/note/highlight/Post'
+import PageNum from 'components/note/highlight/PageNum'
// slices
import { updateHighlight } from 'slices/book'
// utils
diff --git a/src/index.tsx b/src/index.tsx
index 2fa0ce3..d9ab10d 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -1,6 +1,6 @@
import ReactDOM from 'react-dom';
import Reader from 'containers/Reader'
-const EPUB_URL = "react-epub-viewer/files/Alices Adventures in Wonderland.epub";
+const EPUB_URL = "/files/Alices Adventures in Wonderland.epub";
ReactDOM.render(, document.getElementById('root'));
\ No newline at end of file
diff --git a/src/lib/styles/viewerLayout.ts b/src/lib/styles/viewerLayout.ts
index 37b5bcf..68cdd2c 100644
--- a/src/lib/styles/viewerLayout.ts
+++ b/src/lib/styles/viewerLayout.ts
@@ -2,9 +2,9 @@ import ViewerLayout from 'types/viewerLayout'
/** Epub viewer layout size */
const viewerLayout: ViewerLayout = {
- MIN_VIEWER_WIDTH: 600,
+ MIN_VIEWER_WIDTH: 300,
MIN_VIEWER_HEIGHT: 300,
- VIEWER_HEADER_HEIGHT: 54,
+ VIEWER_HEADER_HEIGHT: 64,
VIEWER_FOOTER_HEIGHT: 60,
VIEWER_SIDEMENU_WIDTH: 0
}