Skip to content

Commit

Permalink
improve closing behaviour of pdf button
Browse files Browse the repository at this point in the history
  • Loading branch information
blackforestboi committed Jun 12, 2024
1 parent 942c73a commit 989dca0
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/search-injection/pdf-open-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,24 @@ class Root extends React.Component<RootProps, RootState> {
>
<PrimaryAction
label="Annotate & Summarize this PDF with Memex"
icon="goTo"
icon="highlight"
type="primary"
fullWidth
height={this.props.buttonBarHeight}
size={'large'}
iconColor={
themeVariant === 'dark' ? 'white' : 'white'
}
iconSize="18px"
/>
Annotate & Summarize this PDF with Memex
<CloseButtonContainer>
<Icon
onClick={props.disableImageInjection}
heightAndWidth={'22px'}
onClick={(event) => {
event.stopPropagation()
props.disableImageInjection()
}}
heightAndWidth={'20px'}
icon={'removeX'}
/>
</CloseButtonContainer>
Expand All @@ -103,7 +110,7 @@ export const handleRenderPDFOpenButton = async (
contentScriptsBG: ContentScriptsInterface<'caller'>,
) => {
let pdfOriginalUrl = null
let buttonBarHeight = '40px'
let buttonBarHeight = '24px'

if (
window.location.href.includes('https://arxiv.org/pdf/') &&
Expand Down Expand Up @@ -162,6 +169,8 @@ export const handleRenderPDFOpenButton = async (
pdfOriginalUrl={pdfOriginalUrl}
buttonBarHeight={buttonBarHeight}
disableImageInjection={async () => {
element.style.top = '0px'
element.style.height = `100%`
ReactDOM.unmountComponentAtNode(target)
}}
/>,
Expand All @@ -184,6 +193,6 @@ const ParentContainer = styled.div<{
const CloseButtonContainer = styled.div`
position: absolute;
right: 10px;
top: 5px;
top: 0px;
cursor: pointer;
`

0 comments on commit 989dca0

Please sign in to comment.