-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from knovator/sequencing-redesign_style-updates
Sequencing redesign and Style updates
- Loading branch information
Showing
21 changed files
with
448 additions
and
250 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
const postcss = require('rollup-plugin-postcss'); | ||
const autoprefixer = require('autoprefixer'); | ||
const cssnano = require('cssnano'); | ||
// const cssnano = require('cssnano'); | ||
|
||
module.exports = { | ||
rollup(config, options) { | ||
config.plugins.push( | ||
postcss({ | ||
plugins: [ | ||
autoprefixer(), | ||
cssnano({ | ||
preset: 'default', | ||
}), | ||
// cssnano({ | ||
// preset: 'default', | ||
// }), | ||
], | ||
// inject: false, | ||
// only write out CSS for the first bundle (avoids pointless extra files): | ||
extract: !!options.writeMeta, | ||
}) | ||
); | ||
}), | ||
) | ||
return config; | ||
}, | ||
}; |
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
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,84 +1,82 @@ | ||
import React from "react" | ||
import Button from "../Button" | ||
|
||
const Pagination = ({ | ||
totalPages, | ||
currentPage, | ||
pageSize, | ||
setPageSize, | ||
setCurrentPage, | ||
totalRecords, | ||
limits, | ||
pageLabel = "Page", | ||
nextLabel = "Next", | ||
previousLabel = "Previous", | ||
}: PaginationProps) => { | ||
const pageHandler = (e: React.KeyboardEvent<HTMLInputElement>) => { | ||
if (e.key === "Enter") { | ||
// @ts-ignore | ||
setCurrentPage(Number.parseInt(e.target.value, 10) || 1) | ||
} | ||
} | ||
const handleNumbers = (e: React.KeyboardEvent<HTMLInputElement>) => { | ||
if (["e", "+", "-"].includes(e.key)) { | ||
e.preventDefault() | ||
} | ||
} | ||
const pageChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
if (e.target.value && Number(e.target.value) <= totalPages && e.target.value !== "0") { | ||
setCurrentPage(Number.parseInt(e.target.value, 10)) | ||
} | ||
} | ||
return ( | ||
<div className="kms_pagination"> | ||
<div> | ||
{(currentPage - 1) * pageSize + 1} - {Math.min(currentPage * pageSize, totalRecords)} of {totalRecords} | ||
</div> | ||
<div className="kms_pagination-actions"> | ||
<Button | ||
size="sm" | ||
label={previousLabel} | ||
onClick={() => setCurrentPage(currentPage - 1)} | ||
disabled={currentPage - 1 === 0} | ||
/> | ||
<div className="kms_pagination-pager"> | ||
{pageLabel} | ||
<input | ||
className="kms_input kms_input-sm w-10" | ||
maxLength={3} | ||
pattern="([0-9]|[0-9]|[0-9])" | ||
type="number" | ||
onKeyDown={handleNumbers} | ||
onKeyPress={pageHandler} | ||
value={currentPage} | ||
onChange={pageChange} | ||
/> | ||
/ {totalPages} | ||
</div> | ||
{Array.isArray(limits) ? ( | ||
<select | ||
value={pageSize} | ||
className="kms_input kms_input-sm" | ||
onChange={(e) => setPageSize(Number(e.target.value))} | ||
> | ||
{limits.map((pageSize) => ( | ||
<option key={pageSize} value={pageSize}> | ||
Show {pageSize} | ||
</option> | ||
))} | ||
</select> | ||
) : null} | ||
<Button | ||
size="sm" | ||
label={nextLabel} | ||
onClick={() => setCurrentPage(currentPage + 1)} | ||
disabled={currentPage === totalPages} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
Pagination.type = "Pagination" | ||
|
||
export default Pagination | ||
import React from "react" | ||
import Button from "../Button" | ||
|
||
const Pagination = ({ | ||
totalPages, | ||
currentPage, | ||
pageSize, | ||
setPageSize, | ||
setCurrentPage, | ||
totalRecords, | ||
limits, | ||
pageLabel = "Page", | ||
nextLabel = "Next", | ||
previousLabel = "Previous", | ||
}: PaginationProps) => { | ||
const pageHandler = (e: React.KeyboardEvent<HTMLInputElement>) => { | ||
if (e.key === "Enter") { | ||
// @ts-ignore | ||
setCurrentPage(Number.parseInt(e.target.value, 10) || 1) | ||
} | ||
} | ||
const handleNumbers = (e: React.KeyboardEvent<HTMLInputElement>) => { | ||
if (["e", "+", "-"].includes(e.key)) { | ||
e.preventDefault() | ||
} | ||
} | ||
const pageChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
if (e.target.value && Number(e.target.value) <= totalPages && e.target.value !== "0") { | ||
setCurrentPage(Number.parseInt(e.target.value, 10)) | ||
} | ||
} | ||
return ( | ||
<div className="kms_pagination"> | ||
<div> | ||
{(currentPage - 1) * pageSize + 1} - {Math.min(currentPage * pageSize, totalRecords)} of {totalRecords} | ||
</div> | ||
<div className="kms_pagination-actions"> | ||
<Button | ||
label={previousLabel} | ||
onClick={() => setCurrentPage(currentPage - 1)} | ||
disabled={currentPage - 1 === 0} | ||
/> | ||
<div className="kms_pagination-pager"> | ||
{pageLabel} | ||
<input | ||
className="kms_input kms_input-sm w-10" | ||
maxLength={3} | ||
pattern="([0-9]|[0-9]|[0-9])" | ||
type="number" | ||
onKeyDown={handleNumbers} | ||
onKeyPress={pageHandler} | ||
value={currentPage} | ||
onChange={pageChange} | ||
/> | ||
/ {totalPages} | ||
</div> | ||
{Array.isArray(limits) ? ( | ||
<select | ||
value={pageSize} | ||
className="kms_input kms_input-sm" | ||
onChange={(e) => setPageSize(Number(e.target.value))} | ||
> | ||
{limits.map((pageSize) => ( | ||
<option key={pageSize} value={pageSize}> | ||
Show {pageSize} | ||
</option> | ||
))} | ||
</select> | ||
) : null} | ||
<Button | ||
label={nextLabel} | ||
onClick={() => setCurrentPage(currentPage + 1)} | ||
disabled={currentPage === totalPages} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
Pagination.type = "Pagination" | ||
|
||
export default Pagination |
Oops, something went wrong.