-
Notifications
You must be signed in to change notification settings - Fork 116
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
NEW Expand block preview #353
NEW Expand block preview #353
Conversation
50f6d39
to
3bc5633
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.
Looks good overall, just some linting issues to tidy up. Also please remove yarn-error.log and add it to your global git ignore :)
fileUrl, | ||
fileTitle, | ||
content, | ||
previewExpanded, |
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 feels like this should be a context argument
E.g. if (context === 'preview') { return <SummaryComponent ...props />; } else { return <FormBuilderComponent ...props />}
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 you suggest I change the state on Element to, or only rename Content's prop and change the type to a string?
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 see - this is loosely coupled to the container's state name... leave it as is +D
const { link } = this.props; | ||
handleExpand() { | ||
const { | ||
element: { InlineEditable }, |
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 just import the element
and use that` - the fact that the InlineEditable prop is capitalised is misleading, because usually capitalisation in React is used for component names, this sort of implies that it could be renderable
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 coming from GraphQL, which is the reason it is capitalised. Would you still like me to rename it?
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.
Nope, but if you don't destructure it as much as this then you can refer to it as element.InlineEditable
and it's fine =)
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.
Cool, I'll go for your last suggestion. But for consistency I'll do the same with ID, Title, and BlockSchema.
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 please, thanks!
@@ -66,11 +86,16 @@ class Element extends Component { | |||
title={Title} | |||
elementType={BlockSchema.type} | |||
fontIcon={BlockSchema.iconClass} | |||
link={link} | |||
caretClickCallback={(event) => this.handleExpand(event)} |
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.
handleExpand
is already bound to this
in the constructor - I think you could use caretClickCallback={this.handleExpand}
here
@@ -39,6 +40,20 @@ class Header extends Component { | |||
} | |||
} | |||
|
|||
/** | |||
* Handle the opening/closing of the block preview | |||
*/ |
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.
Indentation slightly out
'btn', | ||
{ 'font-icon-right-open-big': !expandable, | ||
'font-icon-up-open-big': expandable && previewExpanded, | ||
'font-icon-down-open-big': expandable && !previewExpanded }); |
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 please format this object a little - each entry on a new line with consistent indentation
3bc5633
to
dbf4b56
Compare
Note to self, rewrite the Behat tests! |
dbf4b56
to
da5a68e
Compare
Resolves silverstripe/silverstripe-elemental-blocks#43
Block is not expandable:
Block is expandable and expanded; the preview is hidden
Block is expandable and not expanded; the preview is shown
Changes in this PR...
FormBuilder
componentSummary
componentContent
and rendered by itContent
unit tests into theSummary
test file, since the latter is handling this logic nowContent
componentElement
componentDesign review by @clarkepaul still outstanding.
The expand button has been tested on Edge 17, IE 11 (browser stack), Chrome 11, Firefox 61, and Safari 11 . It is keyboard accessible on all of these browsers, expect Safari.
Also, the styling is slightly off on Edge 17: