-
Notifications
You must be signed in to change notification settings - Fork 842
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 full-screen code functionality to and remove custom theming from EuiCodeBlock #259
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.
Cool. Think we should just add this to the component itself? Seems useful enough to be an optional prop allowFullscreen
on EuiCodeBlock
?
Stylistically I can clean it up a bit in a separate PR. Functionally I'd add a keydown event for ESC
to close it, otherwise works as advertised.
Good idea @snide! I'll add that. |
e344576
to
78e1936
Compare
@snide I made a few changes. Could you take a look?
|
e6b5d87
to
531fe78
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.
Added full-screen functionality to all code blocks.
Think something is up with your focus-trap / ESC combo. Wasn't able to get either working correctly. I could still tab through the original document. That stuff is tricky.
I'll clean up the styling a bit in a separate PR after you've got it in. Off-hand I'll likely make the icon absolutely positioned so it's always around as you scroll, make the coloring a little more monotone and only show the icon on hover of the block.
Made a few small adjustments to the way the EuiImage code is formatted.
Looks good. All your changes are great.
I changed the way highlighting works so that it adheres to the active theme. I think this makes the most sense in terms of how highlighting colors and theme colors interact.
I ... am ok with this, but I'll likely go in after the fact and clean up that light theme. Probably add a border around the block...etc. I think you'll want to ping @bevacqua just to let him know, since I think he was utilizing some theming overwrites and will need to make some changes to cloud.
src/components/code/_code_block.scss
Outdated
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
padding: $euiSizeL !important; |
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'd bump this up a notch since you have so much space to work with.
|
||
// Code | ||
|
||
$euiCodeBlockBackgroundColor: #F5F5F5 !default; |
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 just $euiColorLightestShade
// Code | ||
|
||
$euiCodeBlockBackgroundColor: #F5F5F5 !default; | ||
$euiCodeBlockColor: #3F3F3F !default; |
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 just $euiTextColor
. Know these seems small, but saves people from needed to edit multiple vars.
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.
Thanks good catch.
@@ -126,18 +128,18 @@ export class EuiImage extends Component { | |||
return ( | |||
<figure | |||
className={classes} | |||
onClick={this.toggleImageFullScreen} | |||
onClick={allowFullScreen ? this.openFullScreen : undefined} |
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.
TY. This is a better way to do this.
CHANGELOG.md
Outdated
No public interface changes since `0.0.11`. | ||
**Breaking changes** | ||
|
||
- Removed `color` prop from `<EuiCodeBlock>`. This component's highlighting now matches whichever theme is currently active. [(#259)](https://github.com/elastic/eui/pull/259) |
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.
When we do a breaking change like this, can we make it a policy to put upgrade instructions in the PR itself. I think I did that for the last couple, and if not I should be! This ones funny though in that it won't technically break, it should just stylistically change.
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 totally agree. Should I just add a note that this may result in a stylistic shift but no change in functionality, since color
is now just a no-op? I figure that people will know to remove the use of this prop now that it no longer exists, but I can mention that too if you think we need to be that explicit.
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 think we just check on each other when we make merges to add something like the below...
Upgrade path
This PR only changes the look of previous code blocks and does not require any changes if you are OK with the new styling. It will however break styling if you were applying custom code block themes beyond the default values. To retain that custom coloring, you'll want to apply those color values to the colors.scss
files directly now.
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.
Ahhh I think I get it! You mean we need to update the CHANGELOG
with fallout caused by breaking changes to the SCSS, too right? I completely overlooked that, so thanks for pointing it out. I just pushed an update, let me know if I need to adjust it.
@snide Thanks for the solid feedback. I addressed your notes, could you take another look? I also added Nico as a reviewer, thanks for that suggestion. Your style improvements sound great. This PR was pretty quick-and-dirty from a design standpoint. |
f9f74aa
to
26e79c1
Compare
26e79c1
to
2e4771d
Compare
@uboness You can rebase |
This change also removes the
.euiCodeBlock--dark
and.euiCodeBlock--light
classes. If you have CSS selectors which depend upon these classes then your<EuiCodeBlock>
instances may appear broken. To reinstate the styles applied by those selectors, you'll have to apply those color values as SCSS color variables.