generated from allen-cell-animated/github-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: packing input #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1c35855
separate out json viewer and dropdown from packing input
rugeli 4215320
rearrange styles
rugeli 9cbd675
style reorg and clean unused styles
rugeli 1913fbe
add constants
rugeli 52b3e2d
Merge branch 'main' of https://github.com/mesoscope/cellpack-client i…
rugeli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { FirebaseDict } from "../../types"; | ||
| import { FIRESTORE_FIELDS } from "../../constants/firebaseConstants"; | ||
|
|
||
| interface DropdownProps { | ||
| value: string; | ||
| placeholder: string; | ||
| options: FirebaseDict; | ||
| onChange: (value: string) => void; | ||
| } | ||
|
|
||
| const Dropdown = (props: DropdownProps): JSX.Element => { | ||
| const { value, placeholder, options, onChange } = props; | ||
|
|
||
| return ( | ||
| <select | ||
| value={value} | ||
| onChange={(e) => onChange(e.target.value)} | ||
| > | ||
| <option value="" disabled> | ||
| {placeholder} | ||
| </option> | ||
| {Object.entries(options).map(([key, value]) => ( | ||
| <option key={key} value={value[FIRESTORE_FIELDS.FIREBASE_ID]}> | ||
| {key} | ||
| </option> | ||
| ))} | ||
| </select> | ||
| ); | ||
| }; | ||
|
|
||
| export default Dropdown; |
This file contains hidden or 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,3 +1,8 @@ | ||
| .collapsible { | ||
| width: 450px; | ||
| margin-top: 5%; | ||
| } | ||
|
|
||
| .log-box { | ||
| display: flex; | ||
| justify-content: space-between; | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import "./style.css"; | ||
|
|
||
| interface JSONViewerProps { | ||
| title: string; | ||
| content: string; | ||
| isVisible: boolean; | ||
| isEditable?: boolean; | ||
| onToggle: () => void; | ||
| onChange?: (value: string) => void; | ||
| } | ||
|
|
||
| const JSONViewer = (props: JSONViewerProps): JSX.Element => { | ||
| const { title, content, isVisible, isEditable = false, onToggle, onChange } = props; | ||
| if (!content) { | ||
| return (<></>) | ||
| } | ||
| return ( | ||
| <div className={`${title.toLowerCase()}-box`}> | ||
| <button type="button" className="collapsible" onClick={onToggle}> | ||
| {title} | ||
| </button> | ||
| <div className={`${title.toLowerCase()}-json`}> | ||
| {isVisible && ( | ||
| isEditable ? ( | ||
| <textarea | ||
| value={content} | ||
| onChange={(e) => onChange?.(e.target.value)} | ||
| /> | ||
| ) : ( | ||
| <pre>{content}</pre> | ||
| ) | ||
| )} | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default JSONViewer; |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| .recipe-box { | ||
| width: 45%; | ||
| float: left; | ||
| } | ||
|
|
||
| .config-box { | ||
| width: 45%; | ||
| float: right; | ||
| } | ||
|
|
||
| .recipe-json { | ||
| max-height: 300px; | ||
| width: 450px; | ||
| overflow-y: auto; | ||
| } | ||
|
|
||
| .config-json { | ||
| max-height: 300px; | ||
| width: 450px; | ||
| overflow-y: auto; | ||
| } | ||
|
|
||
| .collapsible { | ||
| width: 450px; | ||
| margin-top: 5%; | ||
| } | ||
|
|
||
| textarea { | ||
| width: 450px; | ||
| height: 300px; | ||
| padding: 12px 20px; | ||
| box-sizing: border-box; | ||
| border: 2px solid #ccc; | ||
| border-radius: 4px; | ||
| font-size: 13px; | ||
| resize: none; | ||
| } |
This file contains hidden or 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 hidden or 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,32 +1,6 @@ | ||
| .recipe-box { | ||
| width: 45%; | ||
| float: left; | ||
| } | ||
|
|
||
| .config-box { | ||
| width: 45%; | ||
| float: right; | ||
| } | ||
|
|
||
| .recipe-json { | ||
| max-height: 300px; | ||
| width: 450px; | ||
| overflow-y: auto; | ||
| } | ||
|
|
||
| .config-json { | ||
| max-height: 300px; | ||
| width: 450px; | ||
| overflow-y: auto; | ||
| } | ||
|
|
||
| textarea { | ||
| width: 450px; | ||
| height: 300px; | ||
| padding: 12px 20px; | ||
| box-sizing: border-box; | ||
| border: 2px solid #ccc; | ||
| border-radius: 4px; | ||
| font-size: 13px; | ||
| resize: none; | ||
| .box { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| flex-direction: row; | ||
| text-align: start; | ||
| } |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not so great that I added
.collapsibleinto two stylesheets for button, but I personally think it's fine for now because the design is not yet finalized and in this pr our focus is on components and style isolation. We'll likely want to have a shared button component with its own stylesheet to consolidate moving forward.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, making a button component is definitely in our future, so having this duplicate .collapsible code is temporary, and I don't think we need to bother worrying about it right now