|
|
@ -11,6 +11,10 @@ import ControlIconBtn from "components/option/ControlIconBtn"; |
|
|
|
import { BookStyle, BookFontFamily, BookFlow } from "types/book"; |
|
|
|
import { BookStyle, BookFontFamily, BookFlow } from "types/book"; |
|
|
|
import { MenuControl } from "lib/hooks/useMenu"; |
|
|
|
import { MenuControl } from "lib/hooks/useMenu"; |
|
|
|
import { BookOption } from "types/book"; |
|
|
|
import { BookOption } from "types/book"; |
|
|
|
|
|
|
|
import * as styles from 'lib/styles/styles' |
|
|
|
|
|
|
|
import palette from 'lib/styles/palette' |
|
|
|
|
|
|
|
import styled, { css } from 'styled-components' |
|
|
|
|
|
|
|
|
|
|
|
import Setting from "components/Setting/setting"; |
|
|
|
import Setting from "components/Setting/setting"; |
|
|
|
|
|
|
|
|
|
|
|
const Option = ( |
|
|
|
const Option = ( |
|
|
@ -140,43 +144,7 @@ const Option = ( |
|
|
|
ref={ref} |
|
|
|
ref={ref} |
|
|
|
> |
|
|
|
> |
|
|
|
<OptionLayout> |
|
|
|
<OptionLayout> |
|
|
|
<Setting/> |
|
|
|
<ControlIconBtnWrapper title="نحوه دیدن صفحه"> |
|
|
|
</OptionLayout> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</Wrapper> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
</> |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
|
|
|
|
|
control: MenuControl; |
|
|
|
|
|
|
|
bookStyle: BookStyle; |
|
|
|
|
|
|
|
bookOption: BookOption; |
|
|
|
|
|
|
|
bookFlow: BookFlow; |
|
|
|
|
|
|
|
onToggle: () => void; |
|
|
|
|
|
|
|
emitEvent: () => void; |
|
|
|
|
|
|
|
onBookStyleChange: (bookStyle: BookStyle) => void; |
|
|
|
|
|
|
|
onBookOptionChange: (bookOption: BookOption) => void; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type SliderType = |
|
|
|
|
|
|
|
| "FontSize" |
|
|
|
|
|
|
|
| "LineHeight" |
|
|
|
|
|
|
|
| "MarginHorizontal" |
|
|
|
|
|
|
|
| "MarginVertical"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type ViewType = { |
|
|
|
|
|
|
|
active: boolean; |
|
|
|
|
|
|
|
spread: boolean; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default React.forwardRef(Option); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/* <ControlIconBtnWrapper title="View Direction"> |
|
|
|
|
|
|
|
<ControlIconBtn |
|
|
|
<ControlIconBtn |
|
|
|
type="ScrollHorizontal" |
|
|
|
type="ScrollHorizontal" |
|
|
|
alt="Horizontal View" |
|
|
|
alt="Horizontal View" |
|
|
@ -192,31 +160,31 @@ export default React.forwardRef(Option); |
|
|
|
onClick={() => onClickDirection("Vertical")} |
|
|
|
onClick={() => onClickDirection("Vertical")} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</ControlIconBtnWrapper> |
|
|
|
</ControlIconBtnWrapper> |
|
|
|
<ControlIconBtnWrapper title="View Spread"> |
|
|
|
<ControlIconBtnWrapper title="حالت صفحه"> |
|
|
|
<ControlIconBtn |
|
|
|
<ControlIconBtn |
|
|
|
type="BookOpen" |
|
|
|
type="BookOpen" |
|
|
|
alt="Two Page View" |
|
|
|
alt="دو صفحه" |
|
|
|
active={viewType.active} |
|
|
|
active={viewType.active} |
|
|
|
isSelected={viewType.spread} |
|
|
|
isSelected={viewType.spread} |
|
|
|
onClick={() => onClickViewType(true)} |
|
|
|
onClick={() => onClickViewType(true)} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<ControlIconBtn |
|
|
|
<ControlIconBtn |
|
|
|
type="BookClose" |
|
|
|
type="BookClose" |
|
|
|
alt="One Page View" |
|
|
|
alt="تک صفحه" |
|
|
|
active={viewType.active} |
|
|
|
active={viewType.active} |
|
|
|
isSelected={!viewType.spread} |
|
|
|
isSelected={!viewType.spread} |
|
|
|
onClick={() => onClickViewType(false)} |
|
|
|
onClick={() => onClickViewType(false)} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</ControlIconBtnWrapper> |
|
|
|
</ControlIconBtnWrapper> |
|
|
|
<OptionDropdown |
|
|
|
<OptionDropdown |
|
|
|
title="Font" |
|
|
|
title="فونت" |
|
|
|
defaultValue={fontFamily} |
|
|
|
defaultValue={fontFamily} |
|
|
|
valueList={["Nazanin", "Sans"]} |
|
|
|
valueList={["Nazanin", "Sans"]} |
|
|
|
onSelect={onSelectFontFamily} |
|
|
|
onSelect={onSelectFontFamily} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<OptionSlider |
|
|
|
<OptionSlider |
|
|
|
active={true} |
|
|
|
active={true} |
|
|
|
title="Size" |
|
|
|
title="اندازه" |
|
|
|
minValue={8} |
|
|
|
minValue={8} |
|
|
|
maxValue={36} |
|
|
|
maxValue={36} |
|
|
|
defaultValue={fontSize} |
|
|
|
defaultValue={fontSize} |
|
|
@ -225,14 +193,27 @@ onChange={(e) => onChangeSlider("FontSize", e)} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<OptionSlider |
|
|
|
<OptionSlider |
|
|
|
active={true} |
|
|
|
active={true} |
|
|
|
title="Line height" |
|
|
|
title="فاصله ی بین خط ها" |
|
|
|
minValue={1} |
|
|
|
minValue={1} |
|
|
|
maxValue={3} |
|
|
|
maxValue={3} |
|
|
|
defaultValue={lineHeight} |
|
|
|
defaultValue={lineHeight} |
|
|
|
step={0.1} |
|
|
|
step={0.1} |
|
|
|
onChange={(e) => onChangeSlider("LineHeight", e)} |
|
|
|
onChange={(e) => onChangeSlider("LineHeight", e)} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<OptionSlider |
|
|
|
<OptionTitle>رنگ ها</OptionTitle> |
|
|
|
|
|
|
|
<BtnWrapper> |
|
|
|
|
|
|
|
<Btn>الف</Btn> |
|
|
|
|
|
|
|
<Btn>الف</Btn> |
|
|
|
|
|
|
|
<Btn>الف</Btn> |
|
|
|
|
|
|
|
<Btn>الف</Btn> |
|
|
|
|
|
|
|
</BtnWrapper> |
|
|
|
|
|
|
|
<BtnWrapper> |
|
|
|
|
|
|
|
<Btn>الف</Btn> |
|
|
|
|
|
|
|
<Btn>الف</Btn> |
|
|
|
|
|
|
|
<Btn>الف</Btn> |
|
|
|
|
|
|
|
<Btn>الف</Btn> |
|
|
|
|
|
|
|
</BtnWrapper> |
|
|
|
|
|
|
|
{/* <OptionSlider |
|
|
|
active={true} |
|
|
|
active={true} |
|
|
|
title="Horizontal margin" |
|
|
|
title="Horizontal margin" |
|
|
|
minValue={0} |
|
|
|
minValue={0} |
|
|
@ -240,8 +221,8 @@ maxValue={100} |
|
|
|
defaultValue={marginHorizontal} |
|
|
|
defaultValue={marginHorizontal} |
|
|
|
step={1} |
|
|
|
step={1} |
|
|
|
onChange={(e) => onChangeSlider("MarginHorizontal", e)} |
|
|
|
onChange={(e) => onChangeSlider("MarginHorizontal", e)} |
|
|
|
/> |
|
|
|
/> */} |
|
|
|
<OptionSlider |
|
|
|
{/* <OptionSlider |
|
|
|
active={bookFlow === "paginated"} |
|
|
|
active={bookFlow === "paginated"} |
|
|
|
title="Vertical margin" |
|
|
|
title="Vertical margin" |
|
|
|
minValue={0} |
|
|
|
minValue={0} |
|
|
@ -250,3 +231,70 @@ defaultValue={marginVertical} |
|
|
|
step={1} |
|
|
|
step={1} |
|
|
|
onChange={(e) => onChangeSlider("MarginVertical", e)} |
|
|
|
onChange={(e) => onChangeSlider("MarginVertical", e)} |
|
|
|
/> */} |
|
|
|
/> */} |
|
|
|
|
|
|
|
</OptionLayout> |
|
|
|
|
|
|
|
</Wrapper> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
</> |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
|
|
|
|
|
control: MenuControl; |
|
|
|
|
|
|
|
bookStyle: BookStyle; |
|
|
|
|
|
|
|
bookOption: BookOption; |
|
|
|
|
|
|
|
bookFlow: BookFlow; |
|
|
|
|
|
|
|
onToggle: () => void; |
|
|
|
|
|
|
|
emitEvent: () => void; |
|
|
|
|
|
|
|
onBookStyleChange: (bookStyle: BookStyle) => void; |
|
|
|
|
|
|
|
onBookOptionChange: (bookOption: BookOption) => void; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Btn = styled.button` |
|
|
|
|
|
|
|
position: relative; |
|
|
|
|
|
|
|
height: 100%; |
|
|
|
|
|
|
|
padding: 0 12px; |
|
|
|
|
|
|
|
dispayl: flex; |
|
|
|
|
|
|
|
align-items: center; |
|
|
|
|
|
|
|
justify-content: center; |
|
|
|
|
|
|
|
z-index: 0; |
|
|
|
|
|
|
|
transition: .3s ${styles.transition}; |
|
|
|
|
|
|
|
outline: none; |
|
|
|
|
|
|
|
&::before { |
|
|
|
|
|
|
|
content: ''; |
|
|
|
|
|
|
|
position: absolute; |
|
|
|
|
|
|
|
left: 0; |
|
|
|
|
|
|
|
right: 0; |
|
|
|
|
|
|
|
top: 0; |
|
|
|
|
|
|
|
bottom: 0; |
|
|
|
|
|
|
|
margin: auto; |
|
|
|
|
|
|
|
z-index: -1; |
|
|
|
|
|
|
|
border-radius: 30px; |
|
|
|
|
|
|
|
transition: .1s ${styles.transition}; |
|
|
|
|
|
|
|
background-color: rgb(0, 154, 168); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
const BtnWrapper = styled.div` |
|
|
|
|
|
|
|
display: flex; |
|
|
|
|
|
|
|
align-items: center; |
|
|
|
|
|
|
|
justify-content: space-around; |
|
|
|
|
|
|
|
padding: 8px 0; |
|
|
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
const OptionTitle = styled.div` |
|
|
|
|
|
|
|
font-size: 14px; |
|
|
|
|
|
|
|
font-weight: 500; |
|
|
|
|
|
|
|
margin-bottom: 16px; |
|
|
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
type SliderType = |
|
|
|
|
|
|
|
| "FontSize" |
|
|
|
|
|
|
|
| "LineHeight" |
|
|
|
|
|
|
|
| "MarginHorizontal" |
|
|
|
|
|
|
|
| "MarginVertical"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type ViewType = { |
|
|
|
|
|
|
|
active: boolean; |
|
|
|
|
|
|
|
spread: boolean; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default React.forwardRef(Option); |
|
|
|