-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add basic shell for Vault view #23
Conversation
fe/src/js/main/Layout.js
Outdated
<Header /> | ||
<main id="main-content">{children}</main> | ||
<Footer /> |
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.
❓ - Do we want to keep the Header and Footer while they're not implemented yet?
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.
Yeah I vote for removing the header and footer until we have them designed and implemented!
fe/src/js/main/Layout.js
Outdated
@@ -22,13 +22,13 @@ function Layout({ flashMessages, pathname, children }) { | |||
scrollToTop() | |||
}, [pathname]) | |||
return ( | |||
<div> | |||
<div style={{ height: '100%' }}> |
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.
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.
@DavidCorrea will this still be needed when the header and footer are eventually designed and added back in?
I'm a little ignorant on CSS practices...can we keep this 100% height but move it to the stylesheet?
fe/src/js/main/Layout.js
Outdated
<Header /> | ||
<main id="main-content">{children}</main> | ||
<Footer /> | ||
<main id="main-content" style={{ height: '100%' }}> |
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.
|
||
function FileTree({ folders }) { | ||
return ( | ||
<aside className="vault__file-tree"> |
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.
❓ - How do we want to approach CSS classes names? Do we want to use BEM? Any other convention?
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.
If you are used to using BEM, I'd be good with that.
I'd defer to @ambernardi on this. Analisa, do you have any preferences on class naming conventions?
I think the two of you will be handling most of the styling, so I'm good with whatever y'all choose!
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.
At the risk of proposing an additional technology, CSS Modules provides unique classnames without the developer-knowledge-overhead and eventually frequent structural updates required of BEM classes. Just an idea; not a hill I would die on.
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 should note that styled-components
also provides the same benefits listed above, but it's incredibly slow (it relies on extensive amounts of JS at runtime) and I've seen it abused in two different companies, so I can't recommend it.
import exact from 'prop-types-exact' | ||
|
||
const propTypes = { | ||
content: PropTypes.array.isRequired, |
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.
💭 - Used content
here, but mostly as a placeholder, it could be renamed to something more appropiate.
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.
This is a tough one to name...
Maybe "items"? Still generic, but "content" makes me think it would be full of text.
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 like items
! Wanted something that could represent both files and folders but couldn't come up with anything. Items
is perfect.
fe/src/js/main/vault/views/Vault.js
Outdated
const fileTree = { | ||
repository: 'Vault', | ||
folders: [ | ||
{ | ||
id: 1, | ||
parentFolderId: null, | ||
createdAt: '2023-03-11 20:49:53.911774', | ||
updatedAt: '2023-03-19 20:49:53.911774', | ||
repository: 'Vault', | ||
name: 'Northeast Vault', | ||
childrenCount: 3, | ||
path: '/Vault/Northeast Vault', | ||
}, | ||
{ | ||
id: 2, | ||
parentFolderId: null, | ||
createdAt: '2023-03-11 20:49:53.911774', | ||
updatedAt: '2023-03-19 20:49:53.911774', | ||
repository: 'Vault', | ||
name: 'West Coast Vault', | ||
childrenCount: 0, | ||
path: '/Vault/West Coast Vault', | ||
}, | ||
], | ||
files: [], | ||
} |
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.
💭 - As mentioned in the ticket, we're hardcoding this for now.
html, | ||
body, | ||
#root { | ||
height: 100vh; | ||
margin: 0; | ||
} |
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.
fe/src/js/main/Layout.js
Outdated
<Header /> | ||
<main id="main-content">{children}</main> | ||
<Footer /> |
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.
Yeah I vote for removing the header and footer until we have them designed and implemented!
import exact from 'prop-types-exact' | ||
|
||
const propTypes = { | ||
content: PropTypes.array.isRequired, |
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.
This is a tough one to name...
Maybe "items"? Still generic, but "content" makes me think it would be full of text.
|
||
const defaultProps = {} | ||
|
||
function FolderView({ content }) { |
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.
Maybe a name like "FolderContents" might be more appropriate for this component? "FolderView" makes me think it's a view 🤔
fe/src/js/main/Layout.js
Outdated
@@ -22,13 +22,13 @@ function Layout({ flashMessages, pathname, children }) { | |||
scrollToTop() | |||
}, [pathname]) | |||
return ( | |||
<div> | |||
<div style={{ height: '100%' }}> |
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.
@DavidCorrea will this still be needed when the header and footer are eventually designed and added back in?
I'm a little ignorant on CSS practices...can we keep this 100% height but move it to the stylesheet?
|
||
function FileTree({ folders }) { | ||
return ( | ||
<aside className="vault__file-tree"> |
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.
If you are used to using BEM, I'd be good with that.
I'd defer to @ambernardi on this. Analisa, do you have any preferences on class naming conventions?
I think the two of you will be handling most of the styling, so I'm good with whatever y'all choose!
fe/src/js/main/vault/views/Vault.js
Outdated
repository: 'Vault', | ||
folders: [ | ||
{ | ||
id: 1, |
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'll update this in the docs (sorry!), but the id
fields will now be uuid strings instead of integers.
import exact from 'prop-types-exact' | ||
|
||
const propTypes = { | ||
folders: PropTypes.array.isRequired, |
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.
can you add the prop shape to types.json
and make this PropTypes.arrayOf(Types.folder)
?
import exact from 'prop-types-exact' | ||
|
||
const propTypes = { | ||
content: PropTypes.array.isRequired, |
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.
Same comment here as above, can we add a file
shape to types.json
and make this line PropTypes.arrayOf(Types.file).isRequired
?
return ( | ||
<div className="vault__folder-view"> | ||
{content.map((folderOrFile, index) => { | ||
return <div key={index}>{folderOrFile}</div> |
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.
key
should ideally be an identifying attribute that's truly unique, as using an array item's index
can cause bugs if the sort order changes.
2471f9e
to
0d43b89
Compare
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.
Looking awesome! Just wanted to rename a couple things after we learned some details about the Vault/ExhibitShare being combined in one toggle-able view. After we rename those I think we'll be good to go!
fe/src/js/main/vault/views/Vault.js
Outdated
|
||
const defaultProps = {} | ||
|
||
function Vault() { |
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.
After talking to Analisa about design plans, it sounds like Vault and ExhibitShare will be one page on which you can toggle between views.
Knowing that, maybe we rename this view? Maybe Library.js
?
fe/src/js/main/Routes.js
Outdated
@@ -17,6 +18,9 @@ function Routes() { | |||
<Route path="/styleguide"> | |||
<StyleguideRoutes /> | |||
</Route> | |||
<Route path="/vault"> |
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.
Similar to other comment, maybe we make this /library
and rename the routes LibraryRoutes
?
items: PropTypes.oneOfType([ | ||
PropTypes.arrayOf(Types.folder).isRequired, | ||
PropTypes.arrayOf(Types.file).isRequired, | ||
]), |
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.
Small refactor possibility would be to extract an Types.item
type, which would be either a Types.folder
or Types.file
, as I'd imagine this union entity will appear in other places in the front-end app over time.
fe/src/scss/application.scss
Outdated
// Styles for Assistive Technologies (keep these last!) | ||
@import 'components/visually-hidden'; |
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.
@DavidCorrea I think this line and its associated comment should be kept at the very bottom of the file to avoid being inadvertently overwritten as this file grows.
a19830c
to
a034873
Compare
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.
One small request to update an key
, but looks good to go! Nice work!
<aside className="library__file-tree"> | ||
{folders.map((folder, index) => { | ||
return ( | ||
<div className="folder" key={index}> |
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.
can we update the key
here to be folder.id
?
Reviewer Details
This PR addresses the basic shell for where the File Tree and the folder content will be displayed.
Items Addressed
Out of scope
Code Review Questions
Author Checklist