Skip to content

Commit

Permalink
Merge pull request #1 from janbaykara/master
Browse files Browse the repository at this point in the history
Conflicts
  • Loading branch information
obfuscatedgenerated authored Jun 2, 2022
2 parents 26a5514 + a233e5d commit 1dfd412
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 47 deletions.
110 changes: 64 additions & 46 deletions src/js/popup/Components.tsx
Original file line number Diff line number Diff line change
@@ -1,53 +1,71 @@
import * as React from "react";
import { Flex, Box, Image, Text, Button } from "rebass";

export const Page: React.SFC<{
url: string;
moveUp: any;
moveDown: any;
}> = ({ url, moveUp, moveDown }) => (
<Flex key={url} alignItems="center">
<Box>
<Image src={url} my={1} width={0.95} height="100px" />
</Box>
<Flex flexDirection="column" justifyContent="around" width={0.05}>
{moveUp && (
<Text css={{ cursor: "pointer" }} onClick={moveUp}>
⬆️
</Text>
)}
{moveDown && (
<Text css={{ cursor: "pointer" }} onClick={moveDown}>
⬇️
</Text>
)}
interface PageParams {
url: any,
moveUp: any,
moveDown: any
}

function Page({ url, moveUp, moveDown }: PageParams) {
return (
<Flex key={url} alignItems="center">
<Box>
<Image src={url} my={1} width={0.95} height="100px" />
</Box>
<Flex flexDirection="column" justifyContent="around" width={0.05}>
{moveUp && (
<Text css={{ cursor: "pointer" }} onClick={moveUp}>
⬆️
</Text>
)}
{moveDown && (
<Text css={{ cursor: "pointer" }} onClick={moveDown}>
⬇️
</Text>
)}
</Flex>
</Flex>
</Flex>
);
)
};

export const ResetButton: React.SFC<{ reset: any, styleOverride?: any }> = ({ reset, styleOverride, children }) => (
<Button
onClick={reset}
css={styleOverride ? styleOverride : {
"text-align": "right",
background: "#FAFAFA",
border: "1px solid red"
}}
color="red"
p={1}
>
{children}
</Button>
);
interface ResetButtonParams {
reset: any,
children: any
}

export const Checkbox: React.SFC<{
checked: boolean;
onChange: any;
}> = ({ checked, onChange, children }) => (
<Box my={1}>
<label>
<input type="checkbox" checked={checked} onChange={onChange} />
function ResetButton({ reset, children }: ResetButtonParams) {
return (
<Button
onClick={reset}
css={{
"text-align": "right",
background: "#FAFAFA",
border: "1px solid red"
}}
color="red"
p={1}
>
{children}
</label>
</Box>
);
</Button>
)
};

interface CheckboxParams {
checked: boolean,
onChange: any,
children: any
}

function Checkbox({ checked, onChange, children }: CheckboxParams) {
return (
<Box my={1}>
<label>
<input type="checkbox" checked={checked} onChange={onChange} />
{children}
</label>
</Box>
)
};

export { Page, ResetButton, Checkbox };
2 changes: 1 addition & 1 deletion src/js/popup/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getURL, getBookURL, getBook } from "../common/utils";
import { Page, ResetButton, Checkbox } from "./Components";
import { createPDF } from './pdf';

const Popup: React.SFC = () => {
function Popup() {
// const [pageNumber, setPageNumber] = useState<number>(undefined);
const [displayPages, setDisplayPages] = useState<boolean>(false);
const [book, setBook] = useState<Book>(undefined);
Expand Down

0 comments on commit 1dfd412

Please sign in to comment.