Skip to content

Commit

Permalink
feat(viewer): Update style of toolbar
Browse files Browse the repository at this point in the history
The style is intentionally non-dynamic.
  • Loading branch information
Merkur39 committed Jan 15, 2025
1 parent 193a69d commit 99b7fc8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
35 changes: 17 additions & 18 deletions packages/cozy-viewer/src/ViewersByFile/PdfJsViewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ let timeoutOpacity
const makeInputPageStyle = nbPages => {
const maxWidth = Math.max(1, String(Math.abs(nbPages)).length - 1)
return {
maxWidth: `${maxWidth}rem`,
marginRight: '0.25rem',
textAlign: 'center',
backgroundColor: 'var(--charcoalGrey)',
border: '2px solid var(--borderMainColor)',
borderRadius: '5px'
maxWidth: `${maxWidth}.5rem`
}
}

Expand Down Expand Up @@ -278,18 +273,22 @@ export class PdfJsViewer extends Component {
disabled={currentPage === 1}
label={t('Viewer.previous')}
/>
<input
ref={this.inputRef}
type="text"
inputMode="numeric"
style={makeInputPageStyle(totalPages)}
value={pageInputValue}
onChange={this.handleInputPageChange}
onKeyDown={this.handleInputPageKeyDown}
onFocus={this.handleInputPageFocus}
onBlur={this.handleInputPageBlur}
/>
/{totalPages}
<label htmlFor="input-page">
<input
ref={this.inputRef}
id="input-page"
className={styles['viewer-pdfviewer-input-page']}
type="text"
inputMode="numeric"
style={makeInputPageStyle(totalPages)}
value={pageInputValue}
onChange={this.handleInputPageChange}
onKeyDown={this.handleInputPageKeyDown}
onFocus={this.handleInputPageFocus}
onBlur={this.handleInputPageBlur}
/>
/{totalPages}
</label>
<ToolbarButton
icon="bottom"
onClick={this.nextPage}
Expand Down
12 changes: 12 additions & 0 deletions packages/cozy-viewer/src/ViewersByFile/styles.styl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@

// rules for specific viewers below

.viewer-pdfviewer-input-page
margin-right 0.25rem
text-align center
color rgb(255, 255, 255)
background-color rgb(50, 54, 63)
border 2px solid rgba(255, 255, 255, 0.32)
border-radius 2px
font-size 0.9rem

&:focus
outline none

.viewer-videoviewer
video
width 100%
Expand Down

0 comments on commit 99b7fc8

Please sign in to comment.