Spaces:
Running
Running
Commit ·
9221bcd
1
Parent(s): 4334de7
Added CoverPages
Browse files
src/Compositions.tsx
CHANGED
|
@@ -216,8 +216,8 @@ export const Compositions: React.FC = () => {
|
|
| 216 |
component={PaperDriveHorizontalCoverComposition}
|
| 217 |
durationInFrames={duration}
|
| 218 |
fps={fps}
|
| 219 |
-
|
| 220 |
-
|
| 221 |
defaultProps={Object.assign(Script, {
|
| 222 |
bgMusic: RenderUtils.getFileName(Script.bgMusic, "mp3"),
|
| 223 |
contents: contents,
|
|
|
|
| 216 |
component={PaperDriveHorizontalCoverComposition}
|
| 217 |
durationInFrames={duration}
|
| 218 |
fps={fps}
|
| 219 |
+
height={Script.meta?.resolution?.width || 1920}
|
| 220 |
+
width={Script.meta?.resolution?.height || 1080}
|
| 221 |
defaultProps={Object.assign(Script, {
|
| 222 |
bgMusic: RenderUtils.getFileName(Script.bgMusic, "mp3"),
|
| 223 |
contents: contents,
|
src/paperdrive/PaperDriveComposition.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
import { Series } from "remotion";
|
| 2 |
import { OriginalManuscript } from 'common-utils';
|
| 3 |
-
import { PaperDrivePage
|
| 4 |
import { PaperDriveIndex } from './PaperDriveIndex';
|
|
|
|
| 5 |
|
| 6 |
export const PaperDriveComposition = (props: OriginalManuscript) => {
|
| 7 |
let { meta } = props
|
|
|
|
| 1 |
import { Series } from "remotion";
|
| 2 |
import { OriginalManuscript } from 'common-utils';
|
| 3 |
+
import { PaperDrivePage } from './PaperDrivePage';
|
| 4 |
import { PaperDriveIndex } from './PaperDriveIndex';
|
| 5 |
+
import { PaperDrivePageExtras } from "./types";
|
| 6 |
|
| 7 |
export const PaperDriveComposition = (props: OriginalManuscript) => {
|
| 8 |
let { meta } = props
|
src/paperdrive/PaperDriveHorizontalCoverComposition.tsx
CHANGED
|
@@ -1,127 +1,190 @@
|
|
| 1 |
import { AbsoluteFill, Img, staticFile } from 'remotion';
|
| 2 |
-
import React from 'react'
|
| 3 |
-
import {
|
| 4 |
-
import { loadFont } from '@remotion/google-fonts/
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
}
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
}
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
"extras": {
|
| 69 |
-
"url": "https://app.mypaperdrive.com/notebooks/page?page=0",
|
| 70 |
-
"marginLeft": "5vh",
|
| 71 |
-
"marginTop": "5vh",
|
| 72 |
-
"marginBottom": "5vh",
|
| 73 |
-
"leftMarginLineColor": "#e0e0e0",
|
| 74 |
-
"lineColor": "#bdbdbd",
|
| 75 |
-
"backgroundColor": "white",
|
| 76 |
-
"qr": {
|
| 77 |
-
"qrStyle": "dots",
|
| 78 |
-
"color": "#1a1a1c",
|
| 79 |
-
"logo": "./logo-transparent-grey.png",
|
| 80 |
-
"logoOpacity": 0.1,
|
| 81 |
-
"size": "7vh",
|
| 82 |
-
"position": {
|
| 83 |
-
"zIndex": 1000,
|
| 84 |
-
"borderWidth": 2,
|
| 85 |
-
"borderColor": "lightgray",
|
| 86 |
-
"borderRadius": 10,
|
| 87 |
-
"backgroundColor": "#fff",
|
| 88 |
-
"padding": 0.1,
|
| 89 |
-
"margin": 5,
|
| 90 |
-
"position": "absolute",
|
| 91 |
-
"top": 0,
|
| 92 |
-
"right": 0
|
| 93 |
}
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
}
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
|
|
|
|
|
|
| 112 |
}
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
|
| 121 |
return (
|
| 122 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
|
| 124 |
|
| 125 |
-
</AbsoluteFill >
|
| 126 |
-
);
|
| 127 |
-
};
|
|
|
|
| 1 |
import { AbsoluteFill, Img, staticFile } from 'remotion';
|
| 2 |
+
import React, { CSSProperties } from 'react'
|
| 3 |
+
import { PaperDrivePageExtras } from './types';
|
| 4 |
+
import { loadFont as loadMontserrat } from '@remotion/google-fonts/Montserrat';
|
| 5 |
+
import { OriginalManuscript, Transcript } from 'common-utils';
|
| 6 |
+
import { RenderUtils } from '../RenderUtils';
|
| 7 |
+
import { QRCode } from 'react-qrcode-logo';
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
export const PaperDriveHorizontalCoverComposition = (props: OriginalManuscript) => {
|
| 11 |
+
const data = props.transcript
|
| 12 |
+
.filter(v => ["front-cover", "back-cover"].includes(v.extras?.template))
|
| 13 |
+
|
| 14 |
+
const frontData = data[0]
|
| 15 |
+
const backData = data[1]
|
| 16 |
+
|
| 17 |
+
return (
|
| 18 |
+
<AbsoluteFill style={{
|
| 19 |
+
padding: 0,
|
| 20 |
+
margin: 0,
|
| 21 |
+
display: 'flex',
|
| 22 |
+
width: '100%',
|
| 23 |
+
height: '100%',
|
| 24 |
+
flexDirection: 'row',
|
| 25 |
+
}}>
|
| 26 |
+
{frontData && <PaperDriveBackCover transcript={backData} style={{
|
| 27 |
+
width: '50%',
|
| 28 |
+
height: '100%',
|
| 29 |
+
paddingRight: 50,
|
| 30 |
+
}} />}
|
| 31 |
+
{backData && <PaperDriveFrontCover transcript={frontData} style={{
|
| 32 |
+
width: '50%',
|
| 33 |
+
height: '100%',
|
| 34 |
+
paddingLeft: 50,
|
| 35 |
+
}} />}
|
| 36 |
+
</AbsoluteFill>
|
| 37 |
+
);
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
export function PaperDriveFrontCover({ transcript, style }: { transcript: Transcript, style?: CSSProperties }) {
|
| 42 |
+
const extras = transcript.extras as PaperDrivePageExtras
|
| 43 |
+
const { fontFamily: Montserrat } = loadMontserrat();
|
| 44 |
+
|
| 45 |
+
const qrImageBlend = extras?.qr?.logo
|
| 46 |
+
const defaultQrSize = RenderUtils.convertVHToPixels(extras?.marginTop ?? '10vh')
|
| 47 |
+
const logo = qrImageBlend ? staticFile(RenderUtils.getFileName(qrImageBlend)!) : undefined
|
| 48 |
+
let qrSize = defaultQrSize
|
| 49 |
+
if (extras?.qr?.size?.includes("vh")) {
|
| 50 |
+
qrSize = RenderUtils.convertVHToPixels(extras?.qr?.size)
|
| 51 |
+
} else if (extras?.qr?.size?.includes("vw")) {
|
| 52 |
+
qrSize = RenderUtils.convertVWToPixels(extras?.qr?.size)
|
| 53 |
+
} else if (extras?.qr?.size) {
|
| 54 |
+
qrSize = parseInt(extras?.qr?.size)
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
return (
|
| 59 |
+
<div style={{
|
| 60 |
+
backgroundColor: extras?.backgroundColor ?? "black",
|
| 61 |
+
...style
|
| 62 |
+
}}>
|
| 63 |
+
<div style={{
|
| 64 |
+
height: '100%',
|
| 65 |
+
display: 'flex',
|
| 66 |
+
flexDirection: 'column',
|
| 67 |
+
alignItems: 'center',
|
| 68 |
+
color: 'white',
|
| 69 |
+
justifyContent: 'space-around'
|
| 70 |
+
}}>
|
| 71 |
+
<div style={{
|
| 72 |
+
...extras.header?.position
|
| 73 |
+
}}>
|
| 74 |
+
{(transcript.title || extras.header?.text_title) && <h1 style={{
|
| 75 |
+
color: extras?.header?.color ?? '#1a1a1c',
|
| 76 |
+
fontFamily: extras?.header?.fontFamily ?? Montserrat,
|
| 77 |
+
...extras?.header?.title_style
|
| 78 |
+
}}>{extras.header?.text_title || transcript.title}</h1>
|
| 79 |
}
|
| 80 |
+
{
|
| 81 |
+
transcript.text && <h1 style={{
|
| 82 |
+
fontFamily: extras?.header?.fontFamily ?? Montserrat,
|
| 83 |
+
...extras?.header?.text_style
|
| 84 |
+
}}>
|
| 85 |
+
{transcript.text}
|
| 86 |
+
</h1>
|
| 87 |
}
|
| 88 |
+
{
|
| 89 |
+
extras?.header?.graphic && (
|
| 90 |
+
<Img
|
| 91 |
+
src={staticFile(RenderUtils.getFileName(extras?.header?.graphic?.source)!)}
|
| 92 |
+
style={{
|
| 93 |
+
...extras?.header?.graphic?.position
|
| 94 |
+
}} />
|
| 95 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
}
|
| 97 |
+
</div>
|
| 98 |
+
<center>
|
| 99 |
+
|
| 100 |
+
<QRCode
|
| 101 |
+
style={extras?.qr?.position ?? {
|
| 102 |
+
zIndex: 1000,
|
| 103 |
+
position: 'absolute',
|
| 104 |
+
top: 50,
|
| 105 |
+
left: 50
|
| 106 |
+
}}
|
| 107 |
+
bgColor={extras?.qr?.backgroundColor ?? 'transparent'}
|
| 108 |
+
fgColor={extras?.qr?.color ?? 'black'}
|
| 109 |
+
size={qrSize ?? defaultQrSize}
|
| 110 |
+
value={extras?.url}
|
| 111 |
+
qrStyle={extras?.qr?.qrStyle ?? 'squares'}
|
| 112 |
+
logoImage={logo}
|
| 113 |
+
logoWidth={qrSize ?? defaultQrSize}
|
| 114 |
+
logoHeight={qrSize ?? defaultQrSize}
|
| 115 |
+
logoOpacity={extras?.qr?.logoOpacity ?? 0.1}
|
| 116 |
+
removeQrCodeBehindLogo={false}
|
| 117 |
+
/>
|
| 118 |
+
{
|
| 119 |
+
extras?.header?.text_sec && (
|
| 120 |
+
<span dangerouslySetInnerHTML={{ __html: extras?.header?.text_sec }} style={{
|
| 121 |
+
fontFamily: Montserrat
|
| 122 |
+
}} />
|
| 123 |
+
)
|
| 124 |
}
|
| 125 |
+
{
|
| 126 |
+
extras?.header?.text_ter &&
|
| 127 |
+
<div
|
| 128 |
+
style={{
|
| 129 |
+
fontFamily: Montserrat
|
| 130 |
+
}}
|
| 131 |
+
dangerouslySetInnerHTML={{ __html: extras?.header?.text_ter }}>
|
| 132 |
+
|
| 133 |
+
</div>
|
| 134 |
}
|
| 135 |
+
|
| 136 |
+
</center>
|
| 137 |
+
</div>
|
| 138 |
+
</div>
|
| 139 |
+
)
|
| 140 |
+
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
export function PaperDriveBackCover({ transcript, style }: { transcript: Transcript, style?: CSSProperties }) {
|
| 148 |
+
const extras = transcript.extras as PaperDrivePageExtras
|
| 149 |
+
|
| 150 |
+
const { fontFamily: Montserrat } = loadMontserrat();
|
| 151 |
|
| 152 |
return (
|
| 153 |
+
<div style={{
|
| 154 |
+
backgroundColor: extras?.backgroundColor ?? "black",
|
| 155 |
+
...style
|
| 156 |
+
}}>
|
| 157 |
+
<div style={{
|
| 158 |
+
fontFamily: Montserrat,
|
| 159 |
+
padding: 50,
|
| 160 |
+
flex: 1,
|
| 161 |
+
height: '100%',
|
| 162 |
+
flexDirection: 'column',
|
| 163 |
+
justifyContent: 'space-between',
|
| 164 |
+
display: 'flex',
|
| 165 |
+
color: 'white'
|
| 166 |
+
}}>
|
| 167 |
+
<div style={{
|
| 168 |
+
...extras.header?.position
|
| 169 |
+
}}>
|
| 170 |
+
<h2 dangerouslySetInnerHTML={{ __html: transcript.title }} />
|
| 171 |
+
<span dangerouslySetInnerHTML={{ __html: transcript.text }} />
|
| 172 |
+
</div>
|
| 173 |
+
|
| 174 |
+
<div>
|
| 175 |
+
{
|
| 176 |
+
extras?.footer?.text && <h2
|
| 177 |
+
dangerouslySetInnerHTML={{ __html: extras?.footer?.text }}
|
| 178 |
+
style={{
|
| 179 |
+
...extras?.footer?.text_style
|
| 180 |
+
}}
|
| 181 |
+
/>
|
| 182 |
+
}
|
| 183 |
+
</div>
|
| 184 |
+
</div>
|
| 185 |
+
</div>
|
| 186 |
+
)
|
| 187 |
+
|
| 188 |
+
}
|
| 189 |
|
| 190 |
|
|
|
|
|
|
|
|
|
src/paperdrive/PaperDriveIndex.tsx
CHANGED
|
@@ -3,8 +3,8 @@ import { CSSProperties, } from "react"
|
|
| 3 |
import { AbsoluteFill } from "remotion"
|
| 4 |
import { loadFont as loadLato } from "@remotion/google-fonts/Lato";
|
| 5 |
import { loadFont as loadPoppins } from "@remotion/google-fonts/Poppins";
|
| 6 |
-
import { PaperDrivePageExtras } from "./PaperDrivePage";
|
| 7 |
import './PaperDriveIndex.css'
|
|
|
|
| 8 |
|
| 9 |
const tableHeadStyles: CSSProperties = {
|
| 10 |
textAlign: 'center'
|
|
|
|
| 3 |
import { AbsoluteFill } from "remotion"
|
| 4 |
import { loadFont as loadLato } from "@remotion/google-fonts/Lato";
|
| 5 |
import { loadFont as loadPoppins } from "@remotion/google-fonts/Poppins";
|
|
|
|
| 6 |
import './PaperDriveIndex.css'
|
| 7 |
+
import { PaperDrivePageExtras } from "./types";
|
| 8 |
|
| 9 |
const tableHeadStyles: CSSProperties = {
|
| 10 |
textAlign: 'center'
|
src/paperdrive/PaperDrivePage.tsx
CHANGED
|
@@ -5,54 +5,11 @@ import { QRCode } from 'react-qrcode-logo';
|
|
| 5 |
import { RenderUtils } from '../RenderUtils';
|
| 6 |
import { loadFont as loadLato } from "@remotion/google-fonts/Lato";
|
| 7 |
import { loadFont as loadPoppins } from "@remotion/google-fonts/Poppins";
|
|
|
|
| 8 |
|
| 9 |
-
export type PaperDrivePageExtras = {
|
| 10 |
-
backgroundColor: string;
|
| 11 |
-
marginBottom: string;
|
| 12 |
-
url: string,
|
| 13 |
-
leftMarginLineColor?: string,
|
| 14 |
-
lineColor?: string,
|
| 15 |
-
marginLeft: string // "10%"
|
| 16 |
-
marginTop: string // "10%"
|
| 17 |
-
template?: "page" | "index" | "one-cover" | "two-cover"
|
| 18 |
-
qr?: {
|
| 19 |
-
logoOpacity?: number;
|
| 20 |
-
logo?: string;
|
| 21 |
-
color?: string | undefined;
|
| 22 |
-
size?: string //200 10vh 10vw
|
| 23 |
-
qrStyle?: "squares" | "dots" | "fluid"
|
| 24 |
-
position?: {
|
| 25 |
-
position: "static" | "relative" | "absolute" | "sticky" | "fixed" // "right"
|
| 26 |
-
top?: number // 0
|
| 27 |
-
left?: number // 0
|
| 28 |
-
bottom?: number // 0
|
| 29 |
-
right?: number // 0
|
| 30 |
-
}
|
| 31 |
-
},
|
| 32 |
-
header?: {
|
| 33 |
-
underline_style?: CSSProperties
|
| 34 |
-
fontFamily?: string // Lato, sans-serif
|
| 35 |
-
color?: string // black
|
| 36 |
-
text_title?: string // Title
|
| 37 |
-
text_date?: string // Date
|
| 38 |
-
text_page?: string // Page
|
| 39 |
-
position?: CSSProperties
|
| 40 |
-
},
|
| 41 |
-
footer?: {
|
| 42 |
-
text?: string // Lorem ipsum dolor
|
| 43 |
-
text_style?: CSSProperties,
|
| 44 |
-
position?: CSSProperties
|
| 45 |
-
},
|
| 46 |
-
index?: {
|
| 47 |
-
pageCount: number,
|
| 48 |
-
columns: { text: string, width: string }[]
|
| 49 |
-
}
|
| 50 |
-
}
|
| 51 |
export function PaperDrivePage({ transcript }: { transcript: Transcript }) {
|
| 52 |
const extras = transcript.extras as PaperDrivePageExtras
|
| 53 |
-
|
| 54 |
-
const defaultQrSize = RenderUtils.convertVHToPixels(extras?.marginTop ?? '10vh')
|
| 55 |
-
const logo = qrImageBlend ? staticFile(RenderUtils.getFileName(qrImageBlend)!) : undefined
|
| 56 |
const watermark = transcript.imageAbsPaths?.[0]
|
| 57 |
let watermarkPath = undefined
|
| 58 |
if (watermark) {
|
|
@@ -61,6 +18,9 @@ export function PaperDrivePage({ transcript }: { transcript: Transcript }) {
|
|
| 61 |
loadLato();
|
| 62 |
loadPoppins();
|
| 63 |
|
|
|
|
|
|
|
|
|
|
| 64 |
let qrSize = defaultQrSize
|
| 65 |
if (extras?.qr?.size?.includes("vh")) {
|
| 66 |
qrSize = RenderUtils.convertVHToPixels(extras?.qr?.size)
|
|
@@ -146,7 +106,7 @@ export function PaperDrivePage({ transcript }: { transcript: Transcript }) {
|
|
| 146 |
<td style={{
|
| 147 |
textAlign: 'left'
|
| 148 |
}}>
|
| 149 |
-
<span dangerouslySetInnerHTML={{ __html: extras?.header?.text_title }} />
|
| 150 |
</td>
|
| 151 |
<td style={{
|
| 152 |
textAlign: 'left',
|
|
@@ -165,10 +125,10 @@ export function PaperDrivePage({ transcript }: { transcript: Transcript }) {
|
|
| 165 |
|
| 166 |
)}
|
| 167 |
{
|
| 168 |
-
extras?.header?.
|
| 169 |
<tr>
|
| 170 |
<td >
|
| 171 |
-
<span dangerouslySetInnerHTML={{ __html: extras?.header?.
|
| 172 |
</td>
|
| 173 |
<td style={{
|
| 174 |
textAlign: 'left',
|
|
@@ -188,10 +148,10 @@ export function PaperDrivePage({ transcript }: { transcript: Transcript }) {
|
|
| 188 |
}
|
| 189 |
|
| 190 |
{
|
| 191 |
-
extras?.header?.
|
| 192 |
<tr>
|
| 193 |
<td>
|
| 194 |
-
<span dangerouslySetInnerHTML={{ __html: extras?.header?.
|
| 195 |
</td>
|
| 196 |
</tr>
|
| 197 |
|
|
|
|
| 5 |
import { RenderUtils } from '../RenderUtils';
|
| 6 |
import { loadFont as loadLato } from "@remotion/google-fonts/Lato";
|
| 7 |
import { loadFont as loadPoppins } from "@remotion/google-fonts/Poppins";
|
| 8 |
+
import { PaperDrivePageExtras } from "./types";
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
export function PaperDrivePage({ transcript }: { transcript: Transcript }) {
|
| 11 |
const extras = transcript.extras as PaperDrivePageExtras
|
| 12 |
+
|
|
|
|
|
|
|
| 13 |
const watermark = transcript.imageAbsPaths?.[0]
|
| 14 |
let watermarkPath = undefined
|
| 15 |
if (watermark) {
|
|
|
|
| 18 |
loadLato();
|
| 19 |
loadPoppins();
|
| 20 |
|
| 21 |
+
const qrImageBlend = extras?.qr?.logo
|
| 22 |
+
const defaultQrSize = RenderUtils.convertVHToPixels(extras?.marginTop ?? '10vh')
|
| 23 |
+
const logo = qrImageBlend ? staticFile(RenderUtils.getFileName(qrImageBlend)!) : undefined
|
| 24 |
let qrSize = defaultQrSize
|
| 25 |
if (extras?.qr?.size?.includes("vh")) {
|
| 26 |
qrSize = RenderUtils.convertVHToPixels(extras?.qr?.size)
|
|
|
|
| 106 |
<td style={{
|
| 107 |
textAlign: 'left'
|
| 108 |
}}>
|
| 109 |
+
<span dangerouslySetInnerHTML={{ __html: extras?.header?.text_title }} style={extras?.header?.title_style} />
|
| 110 |
</td>
|
| 111 |
<td style={{
|
| 112 |
textAlign: 'left',
|
|
|
|
| 125 |
|
| 126 |
)}
|
| 127 |
{
|
| 128 |
+
extras?.header?.text_sec &&
|
| 129 |
<tr>
|
| 130 |
<td >
|
| 131 |
+
<span dangerouslySetInnerHTML={{ __html: extras?.header?.text_sec }} style={extras?.header?.text_style} />
|
| 132 |
</td>
|
| 133 |
<td style={{
|
| 134 |
textAlign: 'left',
|
|
|
|
| 148 |
}
|
| 149 |
|
| 150 |
{
|
| 151 |
+
extras?.header?.text_ter &&
|
| 152 |
<tr>
|
| 153 |
<td>
|
| 154 |
+
<span dangerouslySetInnerHTML={{ __html: extras?.header?.text_ter }} style={extras?.header?.text_style} />
|
| 155 |
</td>
|
| 156 |
</tr>
|
| 157 |
|
src/paperdrive/types/index.ts
CHANGED
|
@@ -1,3 +1,51 @@
|
|
| 1 |
-
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
}
|
|
|
|
| 1 |
+
import { CSSProperties } from "react";
|
| 2 |
|
| 3 |
+
export type PaperDrivePageExtras = {
|
| 4 |
+
backgroundColor: string;
|
| 5 |
+
marginBottom: string;
|
| 6 |
+
url: string,
|
| 7 |
+
leftMarginLineColor?: string,
|
| 8 |
+
lineColor?: string,
|
| 9 |
+
marginLeft: string // "10%"
|
| 10 |
+
marginTop: string // "10%"
|
| 11 |
+
template?: "page" | "index" | "front-cover" | "back-cover"
|
| 12 |
+
qr?: { // only for "page"
|
| 13 |
+
logoOpacity?: number;
|
| 14 |
+
logo?: string;
|
| 15 |
+
color?: string | undefined;
|
| 16 |
+
backgroundColor?: string | undefined;
|
| 17 |
+
size?: string //200 10vh 10vw
|
| 18 |
+
qrStyle?: "squares" | "dots" | "fluid"
|
| 19 |
+
position?: {
|
| 20 |
+
position: "static" | "relative" | "absolute" | "sticky" | "fixed" // "right"
|
| 21 |
+
top?: number // 0
|
| 22 |
+
left?: number // 0
|
| 23 |
+
bottom?: number // 0
|
| 24 |
+
right?: number // 0
|
| 25 |
+
}
|
| 26 |
+
},
|
| 27 |
+
header?: { // only for "page" and "index" and "front-cover" and "back-cover"
|
| 28 |
+
underline_style?: CSSProperties
|
| 29 |
+
fontFamily?: string // Lato, sans-serif
|
| 30 |
+
color?: string // black
|
| 31 |
+
graphic?: {
|
| 32 |
+
source: string,
|
| 33 |
+
position?: CSSProperties
|
| 34 |
+
},
|
| 35 |
+
title_style?: CSSProperties,
|
| 36 |
+
text_style?: CSSProperties,
|
| 37 |
+
text_title?: string // Title
|
| 38 |
+
text_sec?: string // Date
|
| 39 |
+
text_ter?: string // Page
|
| 40 |
+
position?: CSSProperties
|
| 41 |
+
},
|
| 42 |
+
footer?: { // only for "page"
|
| 43 |
+
text?: string // Lorem ipsum dolor
|
| 44 |
+
text_style?: CSSProperties,
|
| 45 |
+
position?: CSSProperties
|
| 46 |
+
},
|
| 47 |
+
index?: { // only for "index"
|
| 48 |
+
pageCount: number,
|
| 49 |
+
columns: { text: string, width: string }[]
|
| 50 |
+
},
|
| 51 |
}
|