-
Notifications
You must be signed in to change notification settings - Fork 392
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
[design] Rework #231
[design] Rework #231
Conversation
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 great work, and the new design looks awesome 😍
I've done a quick code review, and got a few comments. Will do more testing tomorrow.
@import 'part:@sanity/base/theme/variables-style'; | ||
|
||
.root { | ||
composes: root from '../../../../components/src/panes/styles/DefaultPane.css'; |
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 doesn't seem quite right? Should it have been imported as a part instead?
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.
Yes. It seems wrong. But exposing a part for this is also wrong. Im not comfortable exposing all CSS-parts without a documentation. I think all composing internally should be done like this, unless it is a documented part.
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.
But this includes it from outside of the package, and I'm 99% sure this will break in a standalone studio (where this code resides in node_modules
). So either this has to be required from the @sanity/components
module, or from a part.
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 understand. I will make a part of this.
} | ||
|
||
.headerBackground { | ||
composes: headerBackground from '../../../../components/src/panes/styles/DefaultPane.css'; |
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 too
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.
👍
@@ -142,7 +142,7 @@ export default class HotspotImage extends React.PureComponent { | |||
<div style={targetStyles.crop}> | |||
<img | |||
ref={this.setImageElement} | |||
src={src} | |||
src={`${src}?w=500&fit=max`} |
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 as the above comment.
<ImageTool value={{hotspot, crop}} src={imageUrl} onChange={this.handleImageToolChange} /> | ||
<ImageTool | ||
value={{hotspot, crop}} | ||
src={`${imageUrl}?w=500&fit=max`} |
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 will only work if the image url is behind a CDN that supports these params. Can you add these in another layer perhaps?
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.
Agreed. We need a solution for this. Also maybe out of the scope of this pull request.
@@ -0,0 +1,31 @@ | |||
/* global window, document */ | |||
export default function tryFindScrollContainer(element, callback) { |
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.
Why a callback here? It doesn't do anything async?
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.
👍
scrollContainer = document.body | ||
} | ||
|
||
return callback(scrollContainer) |
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 think its better if you just return the scrollContainer here, and where you use it, you can pass it directly to the callback, like this:
callback(tryFindScrollContainer(element))
// e.g instead of.
tryFindScrollContainer(element, this.setScrollContainerElement)
// you can just do
this.setScrollContainerElement(tryFindScrollContainer(element))
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.
👍
@@ -85,9 +85,9 @@ | |||
composes: focusHelper from 'part:@sanity/base/theme/forms/text-input-style'; | |||
background-color: transparent; | |||
|
|||
@nest .hasFocus & { | |||
/*@nest .hasFocus & { |
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.
Remove this?
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.
👍
@@ -38,6 +38,10 @@ class DefaultPreview extends React.Component { | |||
item: {} | |||
} | |||
|
|||
shouldComponentUpdate() { | |||
return true |
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.
Why do we need this?
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.
Old stuff from before PureComponent that the linter complained about. Will remove.
popOverStack.pop() | ||
const prevPopOver = popOverStack.slice(-1)[0] | ||
if (prevPopOver) { | ||
setFocus(prevPopOver) | ||
prevPopOver.moveIntoPosition() | ||
// prevPopOver.moveIntoPosition() |
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.
remove this?
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.
👍
<div style={{display: 'span'}} ref={this.setRootElement}> | ||
<StickyPortal | ||
isOpen={isOpen} | ||
scrollContainer={scrollContainer} |
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.
Why do we need to pass this down? If StickyPortal needs some values from the scrollContainer, its a lot better to pass down these values instead.
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 needs to add an eventListener and get the positions. I think that an ref to an element is a good way to go.
I dont like the "tryFindScrollContainer" way of doing this. In the future it would be nice to control this by passing down props from where the scrollContainer is (desk-tool in this case), or have an global system to control modals/overlay. This is also good for determine what should be closed on pressing escape etc.
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, lets try to fix this properly later.
e5a4bcf
to
c8f1d6c
Compare
2b9582f
to
1e8ff1b
Compare
@@ -31,18 +33,20 @@ | |||
} | |||
|
|||
.focusHelper { | |||
display: none; |
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.
Looks like this should not be here? It's overridden on the line below.
background-color: transparent; | ||
} | ||
|
||
.focusHelperActive { | ||
background-color: var(--focus-color); | ||
background-color: transparent; |
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 also duplicated.
@@ -26,15 +26,15 @@ | |||
composes: focusHelper from 'part:@sanity/base/theme/forms/text-input-style'; | |||
background-color: transparent; | |||
|
|||
@nest .hasFocus & { | |||
/*@nest .hasFocus & { |
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 remove this?
@@ -33,7 +34,7 @@ export default withRouterHOC(class TypePane extends React.PureComponent { | |||
// const isActive = !selectedType && !action && !selectedDocumentId | |||
|
|||
return ( | |||
<Pane {...this.props}> | |||
<Pane {...this.props} styles={contentStylesOverride}> |
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.
Is this intentional? Isn't contentStylesOverride
a CSS modules-export - shouldn't it be a selector and passed to classNames
instead of styles
? Or am I missing something?
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 is intentional, because Pane is a styleable component.
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.
Of course. Got confused by the prop-name 🙃 .
@@ -107,7 +107,7 @@ export default class Item extends React.Component<Props> { | |||
|
|||
return ( | |||
<div className={styles.popupAnchor}> | |||
<EditItemPopOver title={memberType.title} onClose={this.handleEditStop}> | |||
<EditItemPopOver onClose={this.handleEditStop} key={`popOver${item._key}`}> |
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.
No need to prefix the key here as long as it is unique within its parent, so its cleaner to just do key={item._key}
here :)
That's the only design issues I've been able to find! Great work! 👏 |
d0752d3
to
fa9884e
Compare
fa9884e
to
30c19dc
Compare
9454f96
to
beb8e34
Compare
9de3d87
to
d211825
Compare
f306795
to
3522168
Compare
3522168
to
4a46245
Compare
annoyances
50d65b5
to
706b941
Compare
I think this is finally good to merge now. There's a few remaining minor issues that I'll create separate tickets for. So lets merge this into @kristofferj Would you like to hit the Squash and merge button? |
* [components] Adding first version of sticky portal component * [design] Testing new layout * [design] Adjusting input components * [design] Adjusting layout * [design] Tweaking preview and list * [components] Fix button margin * [design] Global selectable states * [design] White content pane * [components] Making menu simpler and using portal-component and tweaking animations * [design] Tweaks on colors etc * [form-builder] Hotspot not loading big images * [components] Tweaks on scrolling * [components] Tidy up the scrolling and overlay * [form-builder] Improving the UI on block editor * [components] Pane content top fix * [components] Pane cleanup and scroll shadow * [form-builder] Linting CSS * [base] Adding check and sync icon * [desk-tool] Styling status in Editor * [default-layout] Fixing top default lauout and search * [default-layout] Fix search * [components] NoMedia on mediarender supports small sizes * [base] Adding back backgrounds style part * [date-input] Using React-datepicker * [components] Fixing dropdown button * [components] Fixing fold out * [componets] Small UI tweaks * [components] Using StickyPortal for dropdown on searchable select * [components] Linting some files * [components] Support origin left right on dropdown button * [desk-tool] Passing up scroll from VirtualList to Pane * [components] Removing callback from tryFindScrollContainer * [pr] Minor changes from pull request * [form-builder] Adding movingItemClass to array of primitives * [components] Progress on preview * [components] Making default pane styles as a part * [base] Overlay on listItemStates * [default-lauout] Better toolSwitcher design * [components] Using CSS grid layout on grid list * [default-layout] Search design improvements * [components] No shadow on pane header when collapsed * [components] Support for title on popover * [components] Fix style on defaultPane * [form-builder] Fixing inline block element * [form-builder] Remove console log * [components] Using lists the intended way * [default-layout] Mobile support for launch design * [form-builder] Fixing styling on array of primitives * [default-layout] Fix branding on desktop] * [default-layout] Mobile header fix * [components] Fix popover for mobile * [form-builder] Fix grid list * [form-builder] Actually use dragHandle when in use * [design] Cleaning up small design annoyances * [form-builder] Making sortable array not show itemStates when drag/movin * [components] SearchableSelect. Not close on click in sticky, and general cleanup * [default-layout] Handling of branding in new design * [form-builder] Clean up reference input and fix a few minor issues * [css] Remove backdrop-filter * [form-builder] Styling of selectAsset * [date-input] Fixing year and month dropdown * [components] Fix: reference picker was emitting an undefined value sometimes * [default-layout] Fix firefox bug * [default-layout] Dont show projectName when brandingLogo exists * [default-layout] Exclude sanity-prefixed types from search * [form-builder] Don't do any conversion on value given to number input * [form-builder] Only display hotspot heading if there are actually image-tool fields * [form-builder] Remove width constraints for now
* [components] Adding first version of sticky portal component * [design] Testing new layout * [design] Adjusting input components * [design] Adjusting layout * [design] Tweaking preview and list * [components] Fix button margin * [design] Global selectable states * [design] White content pane * [components] Making menu simpler and using portal-component and tweaking animations * [design] Tweaks on colors etc * [form-builder] Hotspot not loading big images * [components] Tweaks on scrolling * [components] Tidy up the scrolling and overlay * [form-builder] Improving the UI on block editor * [components] Pane content top fix * [components] Pane cleanup and scroll shadow * [form-builder] Linting CSS * [base] Adding check and sync icon * [desk-tool] Styling status in Editor * [default-layout] Fixing top default lauout and search * [default-layout] Fix search * [components] NoMedia on mediarender supports small sizes * [base] Adding back backgrounds style part * [date-input] Using React-datepicker * [components] Fixing dropdown button * [components] Fixing fold out * [componets] Small UI tweaks * [components] Using StickyPortal for dropdown on searchable select * [components] Linting some files * [components] Support origin left right on dropdown button * [desk-tool] Passing up scroll from VirtualList to Pane * [components] Removing callback from tryFindScrollContainer * [pr] Minor changes from pull request * [form-builder] Adding movingItemClass to array of primitives * [components] Progress on preview * [components] Making default pane styles as a part * [base] Overlay on listItemStates * [default-lauout] Better toolSwitcher design * [components] Using CSS grid layout on grid list * [default-layout] Search design improvements * [components] No shadow on pane header when collapsed * [components] Support for title on popover * [components] Fix style on defaultPane * [form-builder] Fixing inline block element * [form-builder] Remove console log * [components] Using lists the intended way * [default-layout] Mobile support for launch design * [form-builder] Fixing styling on array of primitives * [default-layout] Fix branding on desktop] * [default-layout] Mobile header fix * [components] Fix popover for mobile * [form-builder] Fix grid list * [form-builder] Actually use dragHandle when in use * [design] Cleaning up small design annoyances * [form-builder] Making sortable array not show itemStates when drag/movin * [components] SearchableSelect. Not close on click in sticky, and general cleanup * [default-layout] Handling of branding in new design * [form-builder] Clean up reference input and fix a few minor issues * [css] Remove backdrop-filter * [form-builder] Styling of selectAsset * [date-input] Fixing year and month dropdown * [components] Fix: reference picker was emitting an undefined value sometimes * [default-layout] Fix firefox bug * [default-layout] Dont show projectName when brandingLogo exists * [default-layout] Exclude sanity-prefixed types from search * [form-builder] Don't do any conversion on value given to number input * [form-builder] Only display hotspot heading if there are actually image-tool fields * [form-builder] Remove width constraints for now
* [components] Adding first version of sticky portal component * [design] Testing new layout * [design] Adjusting input components * [design] Adjusting layout * [design] Tweaking preview and list * [components] Fix button margin * [design] Global selectable states * [design] White content pane * [components] Making menu simpler and using portal-component and tweaking animations * [design] Tweaks on colors etc * [form-builder] Hotspot not loading big images * [components] Tweaks on scrolling * [components] Tidy up the scrolling and overlay * [form-builder] Improving the UI on block editor * [components] Pane content top fix * [components] Pane cleanup and scroll shadow * [form-builder] Linting CSS * [base] Adding check and sync icon * [desk-tool] Styling status in Editor * [default-layout] Fixing top default lauout and search * [default-layout] Fix search * [components] NoMedia on mediarender supports small sizes * [base] Adding back backgrounds style part * [date-input] Using React-datepicker * [components] Fixing dropdown button * [components] Fixing fold out * [componets] Small UI tweaks * [components] Using StickyPortal for dropdown on searchable select * [components] Linting some files * [components] Support origin left right on dropdown button * [desk-tool] Passing up scroll from VirtualList to Pane * [components] Removing callback from tryFindScrollContainer * [pr] Minor changes from pull request * [form-builder] Adding movingItemClass to array of primitives * [components] Progress on preview * [components] Making default pane styles as a part * [base] Overlay on listItemStates * [default-lauout] Better toolSwitcher design * [components] Using CSS grid layout on grid list * [default-layout] Search design improvements * [components] No shadow on pane header when collapsed * [components] Support for title on popover * [components] Fix style on defaultPane * [form-builder] Fixing inline block element * [form-builder] Remove console log * [components] Using lists the intended way * [default-layout] Mobile support for launch design * [form-builder] Fixing styling on array of primitives * [default-layout] Fix branding on desktop] * [default-layout] Mobile header fix * [components] Fix popover for mobile * [form-builder] Fix grid list * [form-builder] Actually use dragHandle when in use * [design] Cleaning up small design annoyances * [form-builder] Making sortable array not show itemStates when drag/movin * [components] SearchableSelect. Not close on click in sticky, and general cleanup * [default-layout] Handling of branding in new design * [form-builder] Clean up reference input and fix a few minor issues * [css] Remove backdrop-filter * [form-builder] Styling of selectAsset * [date-input] Fixing year and month dropdown * [components] Fix: reference picker was emitting an undefined value sometimes * [default-layout] Fix firefox bug * [default-layout] Dont show projectName when brandingLogo exists * [default-layout] Exclude sanity-prefixed types from search * [form-builder] Don't do any conversion on value given to number input * [form-builder] Only display hotspot heading if there are actually image-tool fields * [form-builder] Remove width constraints for now
* [components] Adding first version of sticky portal component * [design] Testing new layout * [design] Adjusting input components * [design] Adjusting layout * [design] Tweaking preview and list * [components] Fix button margin * [design] Global selectable states * [design] White content pane * [components] Making menu simpler and using portal-component and tweaking animations * [design] Tweaks on colors etc * [form-builder] Hotspot not loading big images * [components] Tweaks on scrolling * [components] Tidy up the scrolling and overlay * [form-builder] Improving the UI on block editor * [components] Pane content top fix * [components] Pane cleanup and scroll shadow * [form-builder] Linting CSS * [base] Adding check and sync icon * [desk-tool] Styling status in Editor * [default-layout] Fixing top default lauout and search * [default-layout] Fix search * [components] NoMedia on mediarender supports small sizes * [base] Adding back backgrounds style part * [date-input] Using React-datepicker * [components] Fixing dropdown button * [components] Fixing fold out * [componets] Small UI tweaks * [components] Using StickyPortal for dropdown on searchable select * [components] Linting some files * [components] Support origin left right on dropdown button * [desk-tool] Passing up scroll from VirtualList to Pane * [components] Removing callback from tryFindScrollContainer * [pr] Minor changes from pull request * [form-builder] Adding movingItemClass to array of primitives * [components] Progress on preview * [components] Making default pane styles as a part * [base] Overlay on listItemStates * [default-lauout] Better toolSwitcher design * [components] Using CSS grid layout on grid list * [default-layout] Search design improvements * [components] No shadow on pane header when collapsed * [components] Support for title on popover * [components] Fix style on defaultPane * [form-builder] Fixing inline block element * [form-builder] Remove console log * [components] Using lists the intended way * [default-layout] Mobile support for launch design * [form-builder] Fixing styling on array of primitives * [default-layout] Fix branding on desktop] * [default-layout] Mobile header fix * [components] Fix popover for mobile * [form-builder] Fix grid list * [form-builder] Actually use dragHandle when in use * [design] Cleaning up small design annoyances * [form-builder] Making sortable array not show itemStates when drag/movin * [components] SearchableSelect. Not close on click in sticky, and general cleanup * [default-layout] Handling of branding in new design * [form-builder] Clean up reference input and fix a few minor issues * [css] Remove backdrop-filter * [form-builder] Styling of selectAsset * [date-input] Fixing year and month dropdown * [components] Fix: reference picker was emitting an undefined value sometimes * [default-layout] Fix firefox bug * [default-layout] Dont show projectName when brandingLogo exists * [default-layout] Exclude sanity-prefixed types from search * [form-builder] Don't do any conversion on value given to number input * [form-builder] Only display hotspot heading if there are actually image-tool fields * [form-builder] Remove width constraints for now
A visual cleanup for a better UI on sanity
default-layout
desk-tool
components
form-builder
preview