File tree Expand file tree Collapse file tree
src/components/ReadingPanel Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,3 +34,30 @@ export const Primary: Story = {
3434 </ >
3535 ) ,
3636} ;
37+
38+ export const Vertical : Story = {
39+ args : { } ,
40+ render : ( ) => (
41+ < >
42+ < ReadingPanel
43+ targetId = "sample"
44+ settings = { { direction : "vertical" } }
45+ > </ ReadingPanel >
46+ < div >
47+ < p id = "sample" style = { { userSelect : "none" , maxWidth : "400px" } } >
48+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
49+ eiusmod tempor incididunt ut labore et dolore magna aliqua.
50+ Pellentesque habitant morbi tristique senectus et netus et malesuada
51+ fames. Ultrices neque ornare aenean euismod elementum nisi quis.
52+ Euismod elementum nisi quis eleifend quam adipiscing. Est ante in nibh
53+ mauris cursus. Morbi tristique senectus et netus et malesuada fames ac
54+ turpis. Vitae purus faucibus ornare suspendisse. In nisl nisi
55+ scelerisque eu ultrices vitae auctor eu. Purus viverra accumsan in
56+ nisl nisi scelerisque eu ultrices vitae. Ultrices gravida dictum fusce
57+ ut. At quis risus sed vulputate odio. Nisl tincidunt eget nullam non.
58+ Malesuada fames ac turpis egestas sed tempus.
59+ </ p >
60+ </ div >
61+ </ >
62+ ) ,
63+ } ;
Original file line number Diff line number Diff line change 11import styled from "styled-components" ;
2+ import { PanelDirection } from "./settings/settings.types" ;
23
34
45export const PanelButton = styled . div `
6+
7+
58cursor: pointer;
69height: 35px;
710width: 35px;
@@ -15,8 +18,9 @@ border-radius: 50%;
1518` ;
1619
1720
18- export const Container = styled . div `
21+ export const Container = styled . div < { direction ?: PanelDirection } > `
1922 display: flex;
23+ flex-direction: ${ props => props . direction === 'vertical' ? 'column' : 'row' } ;
2024 align-items: center;
2125 background: white;
2226 padding: 5px 2px;
Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ export function ReadingPanel({
136136 } ;
137137
138138 return (
139- < Container >
139+ < Container direction = { settings . direction } >
140140 < >
141141 { ! isOpen && (
142142 < PanelButton onClick = { handleSwitchOpen } >
@@ -155,7 +155,6 @@ export function ReadingPanel({
155155 < PanelButton onClick = { handleFontIncrease } >
156156 < MdTextIncrease > </ MdTextIncrease >
157157 </ PanelButton >
158-
159158 < PanelButton onClick = { handleFontDecrease } >
160159 < MdTextDecrease > </ MdTextDecrease >
161160 </ PanelButton >
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ export interface ColorSettings {
1515
1616 export type Theme = 'light' | 'dark' ;
1717
18+ export type PanelDirection = 'horizontal' | 'vertical'
1819
1920export interface Settings {
2021 colorSettings : ColorSettings ;
@@ -28,7 +29,7 @@ export interface Settings {
2829 lineHeightsStep : number
2930 lineHeightUnits : string ;
3031 startOpen : boolean ;
31- direction : 'horizontal' | 'vertical' ;
32+ direction : PanelDirection ;
3233}
3334
3435export const defaultSettings : Settings = {
You can’t perform that action at this time.
0 commit comments