Skip to content
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

Merged
merged 68 commits into from
Oct 11, 2017
Merged

[design] Rework #231

merged 68 commits into from
Oct 11, 2017

Conversation

kristofferjs
Copy link
Contributor

A visual cleanup for a better UI on sanity

default-layout

  • dark tool-selector on the left side.
  • search on top

desk-tool

  • brighter content-type-pane with shadow in desk-tool
  • consistent styling of content-types-pane
  • Consistent styling of editor top (until we have a better solution)

components

  • A StickyPortal component that follow the scrollcontainer with an onResize-prop
  • Popover that uses StickyPortal to place itself
  • DropDownButton that uses StickyPortal to place itself
  • SearchableSelect that uses StickyPortal to place itself

form-builder

  • Better handling of overflowing toolbar in block-editor (needs collapsing-feature later)
  • Nicer full view
  • more margin on array lists

preview

  • always assume image/media until we can determine if it should be visible or not

@bjoerge bjoerge self-requested a review October 5, 2017 10:42
@kristofferjs kristofferjs changed the base branch from master to next October 5, 2017 10:43
Copy link
Member

@bjoerge bjoerge left a 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';
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This too

Copy link
Contributor Author

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`}
Copy link
Member

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`}
Copy link
Member

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?

Copy link
Contributor Author

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) {
Copy link
Member

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?

Copy link
Contributor Author

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)
Copy link
Member

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))

Copy link
Contributor Author

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 & {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this?

Copy link
Contributor Author

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
Copy link
Member

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?

Copy link
Contributor Author

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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this?

Copy link
Contributor Author

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}
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

@@ -31,18 +33,20 @@
}

.focusHelper {
display: none;
Copy link
Member

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;
Copy link
Member

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 & {
Copy link
Member

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}>
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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}`}>
Copy link
Member

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 :)

@rexxars
Copy link
Member

rexxars commented Oct 9, 2017

image

I personally find the dividers here a bit off-putting.. Could they perhaps be slightly weakened in color? Also, perhaps hide border-top on the first element and border-bottom on the last element?

@rexxars
Copy link
Member

rexxars commented Oct 9, 2017

image
The top-left title is not very readable ;)
Do we have a plan with this area? Hard to fit a longer title in there, perhaps?

@rexxars
Copy link
Member

rexxars commented Oct 9, 2017

image

The "select from library" dialog loads 100x100px images but have a container that is smaller. This results in overlapping images and weird hover-states.

@rexxars
Copy link
Member

rexxars commented Oct 9, 2017

That's the only design issues I've been able to find! Great work! 👏

@bjoerge
Copy link
Member

bjoerge commented Oct 9, 2017

Looks like the reference select doesn't capture clicks anymore:
image

Edit: and using arrow keys to navigate in the list doesn't highlight items either.

@bjoerge
Copy link
Member

bjoerge commented Oct 11, 2017

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 next.

@kristofferj Would you like to hit the Squash and merge button?

@bjoerge bjoerge changed the title Design/launch design [design] Rework Oct 11, 2017
@kristofferjs kristofferjs merged commit d4d8592 into next Oct 11, 2017
@bjoerge bjoerge deleted the design/launch-design branch October 11, 2017 18:12
bjoerge pushed a commit that referenced this pull request Oct 11, 2017
* [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
bjoerge pushed a commit that referenced this pull request Oct 12, 2017
* [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
bjoerge pushed a commit that referenced this pull request Oct 12, 2017
* [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
bjoerge pushed a commit that referenced this pull request Oct 12, 2017
* [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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants