Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Suggested changes styling #1989

Merged
merged 5 commits into from
Feb 28, 2019
Merged

Suggested changes styling #1989

merged 5 commits into from
Feb 28, 2019

Conversation

simurai
Copy link
Contributor

@simurai simurai commented Feb 27, 2019

Description of the Change

This styles the suggested changes in review comments.

Screenshot/Gif

Before After
before after

Alternate Designs

N/A

Benefits

Looks less broken. Easier to see what the suggestion is.

Possible Drawbacks

The diffs use the same colors for dark and light themes again. This could make certain themes look less optimized.

Applicable Issues

Closes #1970

Metrics

N/A

Tests

  1. Open a review comment that has a "suggested change".
  2. Verify the suggested change looks styled.

Documentation

N/A

Release Notes

N/A

User Experience Research (Optional)

N/A

@codecov
Copy link

codecov bot commented Feb 27, 2019

Codecov Report

Merging #1989 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1989      +/-   ##
==========================================
+ Coverage   92.12%   92.13%   +<.01%     
==========================================
  Files         188      188              
  Lines       10806    10807       +1     
  Branches     1581     1581              
==========================================
+ Hits         9955     9957       +2     
+ Misses        851      850       -1
Impacted Files Coverage Δ
lib/views/emoji-reactions-view.js 100% <0%> (ø) ⬆️
lib/containers/remote-container.js 100% <0%> (ø) ⬆️
lib/containers/issueish-detail-container.js 100% <0%> (ø) ⬆️
lib/containers/current-pull-request-container.js 95.12% <0%> (+0.12%) ⬆️
lib/containers/issueish-search-container.js 96% <0%> (+0.16%) ⬆️
lib/models/operation-states.js 91.66% <0%> (+2.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8f80090...f4954a7. Read the comment docs.

@@ -58,4 +58,86 @@
vertical-align: middle;
}


// Suggested changes
.js-suggested-changes-blob {
Copy link
Contributor Author

@simurai simurai Feb 27, 2019

Choose a reason for hiding this comment

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

I assume we don't have much control over the markup that is coming from the GitHub API?

screen shot 2019-02-27 at 3 28 47 pm

.js-suggested-changes-blob shouldn't be used for styling, but it seems like the best identifier to scope "suggested changes". Also, the class names from .com could change anytime and might break the styling in Atom.

I'm ok with shipping this as is, but it might be good to add a TODO or file an issue to communicate that this solution is somewhat fragile.

Choose a reason for hiding this comment

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

yeah, I thought about how styling based on this classname is fragile 😦

On the plus side, no functionality would be broken...it would just look janky again.

The "right" way to do this is to identify "suggested changes" comments based on data attributes that come from the graphQL api (which is probably possible, but I haven't looked at the schema.) . Then we apply our own classname.

@simurai simurai requested a review from a team February 27, 2019 11:38
@simurai simurai marked this pull request as ready for review February 27, 2019 11:38
@simurai
Copy link
Contributor Author

simurai commented Feb 27, 2019

I tried to add user-select: text; and the native-key-bindings class so that the suggestion can be selected and copied, but for some reason, it copies the line above the diff (notice the jump in scroll position) and not the selection? 🤔

copy

Maybe not super necessary once it would be possible to apply the suggested change, but currently it's probably annoying having to retype the line.

// diff colors -----------------
// Needs to be semi transparent to make it work with selections and different themes

@github-diff-deleted: fade(hsl(353, 100%, 66%), 15%); // similar to .com's hsl(353, 100%, 97%)

Choose a reason for hiding this comment

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

so cool. I really want to learn more about css colors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If possible, it's best to only use the UI and syntax theme variables. Then it should look ok in all themes.

But sometimes making an exception is fine too. 😬 In this case, it felt better to use the .com colors for the diff and not "success" and "error". But it needed to be semi transparent to make the selections visible underneath. Less has a bunch of functions to tweak colors, like fade() to make an existing color more transparent.

I also have been using mix() sometimes. For example

.class {
  background-color: mix(@text-color, @base-background-color, 10%);
}

mixes 10% of the text color with the background color -> making the new background color slightly darker with light themes or slightly lighter in dark themes.

@@ -58,4 +58,86 @@
vertical-align: middle;
}


// Suggested changes
.js-suggested-changes-blob {

Choose a reason for hiding this comment

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

yeah, I thought about how styling based on this classname is fragile 😦

On the plus side, no functionality would be broken...it would just look janky again.

The "right" way to do this is to identify "suggested changes" comments based on data attributes that come from the graphQL api (which is probably possible, but I haven't looked at the schema.) . Then we apply our own classname.

@simurai
Copy link
Contributor Author

simurai commented Feb 28, 2019

Ok, let's merge this as is.

@simurai simurai merged commit d42b8e8 into master Feb 28, 2019
@simurai simurai deleted the sm/suggested-changes-styling branch February 28, 2019 02:06
@vanessayuenn vanessayuenn mentioned this pull request Mar 6, 2019
9 tasks
@smashwilson smashwilson added the feature request 003 Work related to the Pull Request Review feature request label May 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature request 003 Work related to the Pull Request Review feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

suggested changes styling looks janky.
3 participants