Demo page styles modified

main
NB 4 years ago
parent 0bfa6da53f
commit 6d273ba959
  1. 2
      package.json
  2. 6
      src/components/learning/highlight/Wrapper.tsx
  3. 3
      src/components/nav/NavItem.tsx
  4. 4
      src/components/option/DropdownItemWrapper.tsx
  5. 5
      src/components/option/DropdownValue.tsx
  6. 8
      src/components/option/SliderValue.tsx
  7. 3
      src/components/sideMenu/CloseBtn.tsx
  8. 4
      src/containers/Reader.tsx
  9. 17
      src/modules/reactViewer/ReactViewer.tsx

@ -1,6 +1,6 @@
{ {
"name": "@altmshfkgudtjr/react-epub-viewer", "name": "@altmshfkgudtjr/react-epub-viewer",
"version": "0.0.1", "version": "0.1.0",
"author": "NB", "author": "NB",
"description": "Epub viewer for React.js powered by Epub.js", "description": "Epub viewer for React.js powered by Epub.js",
"license": "MIT", "license": "MIT",

@ -5,7 +5,6 @@ import * as styles from 'lib/styles/styles'
const Wrapper = styled.button` const Wrapper = styled.button`
padding: 16px 24px; padding: 16px 24px;
box-shadow: 0 3px 6px 0 rgba(0,0,0,.3);
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
justify-content: flex-start; justify-content: flex-start;
@ -14,9 +13,10 @@ const Wrapper = styled.button`
cursor: pointer; cursor: pointer;
outline: none; outline: none;
text-align: left; text-align: left;
border-bottom: 1px solid ${palette.gray1};
&:last-child { &:nth-child(2) {
box-shadow: 0 1px 4px rgb(0 0 0 / 20%); border-top: 1px solid ${palette.gray1};
} }
& > div { & > div {

@ -20,13 +20,14 @@ const Content = styled.button`
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
background-color: ${palette.gray0}; background-color: ${palette.gray0};
outline: none;
& > span { & > span {
transition: .2s ${styles.transition}; transition: .2s ${styles.transition};
font-size: 14px; font-size: 14px;
} }
&:hover { &:focus, &:hover {
& > span { & > span {
color: ${palette.blue3}; color: ${palette.blue3};
margin-left: 12px; margin-left: 12px;

@ -34,6 +34,10 @@ const Container = styled.div<{show: boolean}>`
: 'translateY(-40px) scaleY(0);' : 'translateY(-40px) scaleY(0);'
}; };
${styles.scrollbar(6)} ${styles.scrollbar(6)}
${({show}) => show
? ''
: styles.noselect
};
`; `;
interface Props { interface Props {

@ -30,7 +30,7 @@ const Container = styled.button<{isDropdown: boolean}>`
background-color: ${palette.white}; background-color: ${palette.white};
border: ${({isDropdown}) => isDropdown border: ${({isDropdown}) => isDropdown
? `2px solid ${palette.blue3}` ? `2px solid ${palette.blue3}`
: `2px solid ${palette.gray2}` : `2px solid ${palette.gray1}`
}; };
border-radius: ${({isDropdown}) => isDropdown border-radius: ${({isDropdown}) => isDropdown
? "20px 20px 0 0" ? "20px 20px 0 0"
@ -48,7 +48,8 @@ const Container = styled.button<{isDropdown: boolean}>`
border: 2px solid ${palette.blue3}; border: 2px solid ${palette.blue3};
& > div { & > div {
opacity: .8; opacity: 1;
filter: invert(40%) sepia(85%) saturate(1256%) hue-rotate(210deg) brightness(113%) contrast(101%);
} }
} }
`; `;

@ -74,6 +74,7 @@ const Slider = styled.input<{ active: boolean }>`
border-radius: 6px; border-radius: 6px;
margin: 0; margin: 0;
z-index: 2; z-index: 2;
outline: none;
&::-webkit-slider-thumb { &::-webkit-slider-thumb {
appearance: none; appearance: none;
@ -103,11 +104,16 @@ const Slider = styled.input<{ active: boolean }>`
&:active { &:active {
box-shadow: none; box-shadow: none;
background-color: ${props => props.active background-color: ${props => props.active
? palette.blue0 ? palette.blue3
: '' : ''
}; };
} }
} }
&:focus::-webkit-slider-thumb {
box-shadow: none;
background-color: ${palette.blue3};
}
`; `;
const Icon = styled.span` const Icon = styled.span`

@ -21,8 +21,9 @@ const Btn = styled.button`
align-items: center; align-items: center;
justify-content: center; justify-content: center;
transition: .1s ${styles.transition}; transition: .1s ${styles.transition};
outline: none;
&:hover { &:focus, &:hover {
filter: invert(40%) sepia(85%) saturate(1256%) hue-rotate(210deg) brightness(113%) contrast(101%); filter: invert(40%) sepia(85%) saturate(1256%) hue-rotate(210deg) brightness(113%) contrast(101%);
} }
`; `;

@ -67,6 +67,8 @@ const Reader = ({ url, loadingView }: Props) => {
onUpdateHighlight onUpdateHighlight
} = useHighlight(viewerRef, setIsContextMenu, bookStyle, bookOption.flow); } = useHighlight(viewerRef, setIsContextMenu, bookStyle, bookOption.flow);
/** /**
* Change Epub book information * Change Epub book information
* @param book Epub Book Info * @param book Epub Book Info
@ -130,6 +132,8 @@ const Reader = ({ url, loadingView }: Props) => {
/** ContextMenu off */ /** ContextMenu off */
const onContextmMenuRemove = () => setIsContextMenu(false); const onContextmMenuRemove = () => setIsContextMenu(false);
return (<> return (<>
<ViewerWrapper> <ViewerWrapper>
<Header <Header

@ -1,10 +1,10 @@
import React, { useState, useEffect, useRef, useCallback } from "react"; import React, { useState, useEffect, useRef, useCallback } from "react"
import { Book, Rendition, Contents } from "epubjs"; import { Book, Rendition, Contents } from "epubjs"
import { debounce } from "throttle-debounce" import { debounce } from "throttle-debounce"
// modules
import EpubViewer from "modules/epubViewer/EpubViewer"
// components // components
import LoadingView from 'LoadingView' import LoadingView from 'LoadingView'
// modules
import EpubViewer from "modules/epubViewer/EpubViewer";
// utils // utils
import { timeFormatter } from 'lib/utils/commonUtil' import { timeFormatter } from 'lib/utils/commonUtil'
// styles // styles
@ -95,7 +95,7 @@ const ReactViewer = ({
* Viewer resizing function * Viewer resizing function
* @method * @method
*/ */
const onResize = useCallback(() => { const onResize = useCallback(debounce(250, () => {
if (!rendition) return; if (!rendition) return;
const viewerLayout_ = viewerLayout || { const viewerLayout_ = viewerLayout || {
@ -126,7 +126,7 @@ const ReactViewer = ({
try { try {
rendition.resize(w, h); rendition.resize(w, h);
} catch { } } catch { }
}, [ }), [
rendition, rendition,
viewerLayout, viewerLayout,
bookStyle.marginHorizontal, bookStyle.marginHorizontal,
@ -253,9 +253,8 @@ const ReactViewer = ({
/** Emit screen resizing event */ /** Emit screen resizing event */
useEffect(() => { useEffect(() => {
// TODO debounce 해제 안되는 이슈 수정하기 window.addEventListener('resize', onResize);
window.addEventListener('resize', debounce(250, onResize)); return () => window.removeEventListener('resize', onResize);
return () => window.removeEventListener('resize', debounce(250, onResize));
}, [onResize]); }, [onResize]);
/** Emit selection event */ /** Emit selection event */

Loading…
Cancel
Save