1
0
Fork 0

feat(workbench): Show page count on layout

This commit is contained in:
Joost De Cock 2022-02-20 19:29:14 +01:00
parent 99232fe020
commit a4906eac64
4 changed files with 24 additions and 4 deletions

View file

@ -43,7 +43,7 @@ const PrintLayout = props => {
}
</h2>
<div className="m-4">
<Settings {...props} />
<Settings {...props} draft={draft}/>
</div>
<Draft
draft={draft}

View file

@ -68,7 +68,8 @@ const pagesPlugin = (size='a4', orientation='portrait') => ({
}
y += h
}
this.pages = { cols, rows, count: (cols+1)*(rows+1) }
// Store page count in part
this.pages = { cols, rows, count: cols*rows }
}
}
})

View file

@ -1,18 +1,30 @@
import { useTranslation } from 'next-i18next'
import PageSizePicker from './pagesize-picker'
import OrientationPicker from './orientation-picker'
import PrintIcon from 'shared/components/icons/print'
import RightIcon from 'shared/components/icons/right'
const PrintLayoutSettings = props => {
const settingsProps = {
gist: props.gist,
updateGist: props.updateGist
}
const { cols, rows, count } = props.draft.parts.pages.pages
return (
<div className="flex flex-row gap-4 justify-center">
<div className="flex flex-row gap-8 justify-center">
<PageSizePicker {...props} />
<OrientationPicker {...props} />
<pre>{JSON.stringify(props.gist, null ,2)}</pre>
<div className="flex flex-row font-bold items-center px-0 text-xl">
<PrintIcon />
<span className="ml-2">{count}</span>
<span className="mx-6 opacity-50">|</span>
<RightIcon />
<span className="ml-2">{cols}</span>
<span className="mx-6 opacity-50">|</span>
<div className="rotate-90"><RightIcon /></div>
<span className="text-xl ml-2">{rows}</span>
</div>
</div>
)
}