-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In the new architecture, `Reader` is now a standalone app. Additionally I also found that there is no reason to wrap the stories in `Store`
- Loading branch information
1 parent
8804ab6
commit dfe424b
Showing
8 changed files
with
64 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,55 @@ | ||
import React from "react"; | ||
import React, { CSSProperties, useEffect } from "react"; | ||
import { appendAsset, readerAssets, removeAppendedAssets } from "./helper"; | ||
|
||
const Reader = () => { | ||
return <div>Reader React</div>; | ||
export type ReaderType = { | ||
identifier?: string; | ||
orderId?: string; | ||
}; | ||
|
||
const Reader: React.FC<ReaderType> = ({ identifier, orderId }: ReaderType) => { | ||
useEffect(() => { | ||
readerAssets.forEach(appendAsset); | ||
|
||
return () => { | ||
removeAppendedAssets(); | ||
}; | ||
}, [identifier, orderId]); | ||
|
||
const readerStyles: CSSProperties = { | ||
height: "100vh" | ||
}; | ||
|
||
if (orderId) { | ||
return ( | ||
<div | ||
style={readerStyles} | ||
id="pubhub-reader" | ||
// eslint-disable-next-line react/no-unknown-property | ||
order-id={orderId} | ||
// eslint-disable-next-line react/no-unknown-property, no-script-url | ||
close-href="javascript:window.history.back()" | ||
/> | ||
); | ||
} | ||
|
||
if (identifier) { | ||
return ( | ||
<div | ||
style={readerStyles} | ||
id="pubhub-reader" | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
// eslint-disable-next-line react/no-unknown-property | ||
identifier={identifier} | ||
// eslint-disable-next-line react/no-unknown-property, no-script-url | ||
close-href="javascript:window.history.back()" | ||
/> | ||
); | ||
} | ||
|
||
// eslint-disable-next-line no-console | ||
console.warn("No identifier or orderId provided for the Reader app."); | ||
return null; | ||
}; | ||
|
||
export default Reader; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.