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

Icons, fonts, colors, oh my! Also, more Design System in Studio #2280

Merged
merged 21 commits into from
Sep 25, 2020

Conversation

nucleogenesis
Copy link
Member

@nucleogenesis nucleogenesis commented Sep 22, 2020

Description

Initially went to use the "Noto Sans" font throughout Studio and to apply font colors per Design System to Studio but along the way ended up making more changes than expected due to how Vuetify handles themes and colors and to avoid going through the entire app to apply styles to every component directly to make use of the proper KDS colors and text styles.

  • Vuetify theme now applies the Design System theme tokens over the previously used ones (overrides things like primary but keeps other apparently Studio-specific tokens)

  • Applies the proper text colors by using the theme-generated CSS variables. This means that all of the tokens defined in https://github.com/learningequality/kolibri-design-system/blob/v0.2.x/lib/styles/colorsDefault.js are available as CSS vars in Studio. For example, the text token can be used in CSS on Studio as --v-text-(base | lighten# | darken#) the same as other Vuetify theme colors are.

  • Implements KIconButton by placing it inside of the IconButton component (previously wrapped v-tooltip and v-btn together) and update some token keys uses previously targeting v-icon to use the Design System icon token names. This results in a different appearance of the tooltip for icon buttons by using the Design System tooltips.

  • Applied "Noto Sans" across the front end. In some cases, I kept the previous fonts as fall backs. Some places I left alone - like the Markdown Editor and similar areas where serif or symbol fonts were used.

  • Misc fixes to fix name-collisions between Vuetify and KDS token names and the styles applied with them by default in Vuetify (particularly the background-color on .link, .text classes.)

  • Adding KIconButton ended up being more work than I expected but by the time I realized it was going to be so much more I was kind of pot committed and finished it up. Tokens are renamed, Design System has a PR adding missing icons Adds add icon add_circle_outline kolibri-design-system#110, and I had to tweak some of the code to handle the fact that we're not putting a v-btn in the cards. This resulted in some additional logic around what happens when you click a channel/content/topic card or the buttons within it (copy, info, context, etc). There were resultant style issues that I fixed as well.

  • I also fixed an issue where the badge for a topic in the Clipboard (the purple thing saying how many children there are) was not centered. Just flagging this separately in case someone knows there is a Notion bug-bash issue (I'll give a look later on).

Issue Addressed (if applicable)

Fixes #2264

Steps to Test

Icons & Icon Buttons

  • Generally, it is a good idea to just play with every aspect of the app. Settings, channel edit, content edit, exercise editor,
  • Please go through the app everywhere that you know there is an Icon Button of any kind and please let me know if any are weirdly styled, improperly colored, or just don't do the thing they're supposed to do when clicked/hovered/etc.
  • Please verify that the info, copy, star and context menus for ChannelItem work in all cases (not just "My Channels" but also the public library channels (read only channels). Do this for items in the Clipboard as well. Also please do this on the Channel list and in ChannelEdit where content and topics are listed.
  • Test this logged in as well as not logged in ("Explore without an account") and ensure all of the buttons work and are where they ought to be.
  • Generally keep an eye out for any kind of weird text styles or color inconsistencies.
  • Do you see any fonts other than Noto Sans?

Implementation Notes (optional)

At a high level, how did you implement this?

Icon Buttons

I completely replaced the template for IconButton and made it a wrapper for KIconButton instead. I did this instead of replacing every implementation of IconButton in Studio with KIconButtons because I want to get thoughts from the team before spending the time changing that many files - also this will give us a chance to see if KIconButton can basically just be plugged in wherever we previously used the Studio-custom IconButton

The inspiration for this may be hard to explain but I'll try:

  • I overrode the Vuetify text color, which should apply also to icons.
  • There was no color prop for IconButton - despite my seeing it be passed somewhere - and even with it properly implemented, it was passed to v-btn which does not apply it to the icon properly.
  • I want to use the themeTokens from KDS for the colors now to avoid having to do it later, so I cannot dynamically override which styles are used depending on what prop value is passed
  • KIconButton already solves this basic problem by passing the color props to children directly to style them directly.

KIconButton - however - works exactly how we want it to:

  • Tooltip ✓
  • Color prop that is applied directly to the icon ✓
  • Does everything the v-btn did with events ✓

I add some styles that directly override the Vuetify styles

I'm not sure if this will have undesired consequences but I did not see any except for the one that inspired me to use KIconButton.

Does this introduce any tech-debt items?

  1. Before merging this, I will go through and remove IconButton and replace every use of it with KIconButton. So - no once I do that.

@codecov
Copy link

codecov bot commented Sep 22, 2020

Codecov Report

Merging #2280 into develop will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #2280   +/-   ##
========================================
  Coverage    81.48%   81.48%           
========================================
  Files          293      293           
  Lines        14066    14066           
========================================
  Hits         11462    11462           
  Misses        2604     2604           

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 4395b2c...0647bf8. Read the comment docs.

:href="channelHref"
@click="goToChannelRoute"
Copy link
Contributor

Choose a reason for hiding this comment

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

this may cause a regression of #2156

Copy link
Member Author

Choose a reason for hiding this comment

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

The href is still there, but I e.preventDefault() the click. Do you know if that would still have the same a11y implications or does the existence of the href attribute suffice? I almost removed it but thought it might have a11y uses.

@@ -11,6 +11,8 @@
<html dir="{{ LANGUAGE_BIDI|yesno:'rtl,ltr' }}" lang="{{ LANGUAGE_CODE }}">
<head>
{% block head %}
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
Copy link
Contributor

Choose a reason for hiding this comment

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

In previous work, I specified all possibly subsets to support as wide a range of scripts as possible.

https://developers.google.com/fonts/docs/getting_started#specifying_script_subsets

Modern browsers support unicode-ranges, so the extra downloads will only affect older browsers.

Aside: it looks like we are loading italic font variants. As far as I know, no UI elements in the Kolibri Design System use italic, and Kolibri itself does not bundle italic variants. That said, I'm now realizing that this doesn't mean content doesn't use italics, and indeed our rich text exercise editors and HTML apps both support italics. Recommend we investigate and address this...

Copy link
Contributor

Choose a reason for hiding this comment

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

Eventually, it might be nice to add this to the static/fonts folder so that developers can also see what the UI will look like even if their internet gets disconnected

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be much easier for devs to just install Noto to their local machine: https://www.google.com/get/noto/

Including font files locally requires LFS for large binary files, and some fairly complex CSS code to handle all the unicode ranges for different scripts like we do in Kolibri.

@nucleogenesis nucleogenesis marked this pull request as ready for review September 22, 2020 21:59
@jayoshih jayoshih added the qa-ready Create a demo server for this pull request label Sep 23, 2020
Copy link
Contributor

@jayoshih jayoshih left a comment

Choose a reason for hiding this comment

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

Code looks good! Just a few questions:

  1. Should the title be bolded? I'm seeing a difference here
    image
    image

  2. Do buttons need to be bolded?
    image

I am running into the following error on the devserver, so I can't test more of the page right now on the demo server

Uncaught ReferenceError: regeneratorRuntime is not defined
    at channel_edit-651fde57276e1ec17b6b.js:1
    at channel_edit-651fde57276e1ec17b6b.js:1
    at Object.<anonymous> (channel_edit-651fde57276e1ec17b6b.js:1)
    at __w_pdfjs_require__ (channel_edit-651fde57276e1ec17b6b.js:1)
    at Object.<anonymous> (channel_edit-651fde57276e1ec17b6b.js:1)
    at __w_pdfjs_require__ (channel_edit-651fde57276e1ec17b6b.js:1)
    at Object.<anonymous> (channel_edit-651fde57276e1ec17b6b.js:1)
    at __w_pdfjs_require__ (channel_edit-651fde57276e1ec17b6b.js:1)
    at channel_edit-651fde57276e1ec17b6b.js:1
    at factory (channel_edit-651fde57276e1ec17b6b.js:1)

@micahscopes
Copy link
Contributor

I finally got the channel edit app to load, and came across some errors:

vue.runtime.esm.js:619 [Vue warn]: Invalid prop: custom validator check failed for prop "icon".

found in

---> <KIcon> at node_modules/kolibri-design-system/lib/KIcon/index.vue
       <KButton> at node_modules/kolibri-design-system/lib/buttons-and-links/KButton.vue
         <KIconButton> at node_modules/kolibri-design-system/lib/buttons-and-links/KIconButton.vue
           <IconButton> at shared/views/IconButton.vue
             <VToolbar>
               <CurrentTopicView> at channelEdit/views/CurrentTopicView.vue
                 <VContent>
                   <TreeViewBase> at channelEdit/views/TreeView/TreeViewBase.vue
                     <TreeView> at channelEdit/views/TreeView/index.vue
                       <VApp>
                         <Root>

...

vue.runtime.esm.js:619 [Vue warn]: Error in render: "TypeError: Cannot read property 'icon' of undefined"

found in

---> <KIcon> at node_modules/kolibri-design-system/lib/KIcon/index.vue
       <KButton> at node_modules/kolibri-design-system/lib/buttons-and-links/KButton.vue
         <KIconButton> at node_modules/kolibri-design-system/lib/buttons-and-links/KIconButton.vue
           <IconButton> at shared/views/IconButton.vue
             <VToolbar>
               <CurrentTopicView> at channelEdit/views/CurrentTopicView.vue
                 <VContent>
                   <TreeViewBase> at channelEdit/views/TreeView/TreeViewBase.vue
                     <TreeView> at channelEdit/views/TreeView/index.vue
                       <VApp>
                         <Root>
...
vue.runtime.esm.js:1888 TypeError: Cannot read property 'icon' of undefined
    at VueComponent.svgIconComponent (index.vue:62)
    at Watcher.get (vue.runtime.esm.js:4479)
    at Watcher.evaluate (vue.runtime.esm.js:4584)
    at VueComponent.computedGetter [as svgIconComponent] (vue.runtime.esm.js:4836)
    at Object.get (vue.runtime.esm.js:2072)
    at Proxy.render (index.vue?7192:5)
    at VueComponent.Vue._render (vue.runtime.esm.js:3548)
    at VueComponent.updateComponent (vue.runtime.esm.js:4066)
    at Watcher.get (vue.runtime.esm.js:4479)
    at new Watcher (vue.runtime.esm.js:4468)

@micahscopes
Copy link
Contributor

I was just checking out the exercise editor and noticed that the background color is green on selected v-cards:

Screenshot from 2020-09-24 10-31-23

@micahscopes
Copy link
Contributor

I noticed that when hovering over topic tree list items on the channel edit page, their sizes change:

jumpy topic list items

(I checked and verified the sizes are stable in develop)

top margin pushed the arrows to be flush with the bottom
rather than centered vertically alongside the tab buttons
This commit is too big but it is not worth breaking
down into smaller commits because much of it is
interconnected and I should have done so in progress
the add circle outline icon is not in the design system at this time
so we will need to address this later if desired.
@nucleogenesis
Copy link
Member Author

Code looks good! Just a few questions:

  1. Should the title be bolded? I'm seeing a difference here
    image
    image
  2. Do buttons need to be bolded?
    image

I am running into the following error on the devserver, so I can't test more of the page right now on the demo server

Uncaught ReferenceError: regeneratorRuntime is not defined
    at channel_edit-651fde57276e1ec17b6b.js:1
    at channel_edit-651fde57276e1ec17b6b.js:1
    at Object.<anonymous> (channel_edit-651fde57276e1ec17b6b.js:1)
    at __w_pdfjs_require__ (channel_edit-651fde57276e1ec17b6b.js:1)
    at Object.<anonymous> (channel_edit-651fde57276e1ec17b6b.js:1)
    at __w_pdfjs_require__ (channel_edit-651fde57276e1ec17b6b.js:1)
    at Object.<anonymous> (channel_edit-651fde57276e1ec17b6b.js:1)
    at __w_pdfjs_require__ (channel_edit-651fde57276e1ec17b6b.js:1)
    at channel_edit-651fde57276e1ec17b6b.js:1
    at factory (channel_edit-651fde57276e1ec17b6b.js:1)

I'm only seeing it bolded on the Channel Edit Details page - but that style appears to be set within the component using it.

The others aren't showing bolded for me in Chrome. Perhaps at bug bash we'll get some more reports?

Michaela Robosova added 4 commits September 25, 2020 11:13
KDS theme tokens contain `correct`
field that is set to green (#43A047).
Answers editor used this class to mark
correct answers which introduced
green background to them which should
not be there.
to prevent height glitches on hover
now when we use vertical options
button instead of the horizontal one.
@MisRob
Copy link
Member

MisRob commented Sep 25, 2020

@nucleogenesis @rtibbles I haven't managed to review everything. This is all I have for today:

I've just opened two pull requests:

Studio
nucleogenesis#1
Merged develop and added several fixes - please see commit messages

KDS
learningequality/kolibri-design-system#117
Fixes tooltips z-index issues:

Before After
before-1 after-1
before-2 after-2

I noticed other minor issues but don't consider resolving them necessary to merge this PR before the bug hunt (it's just admin):

/administration/#/channels - download and pdf icons vertically misaligned
admin-channels-icons

/administration/#/users - e-mail icon vertically misaligned
admin-users-icons

@rtibbles rtibbles merged commit e78b0b8 into learningequality:develop Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
qa-ready Create a demo server for this pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need to update font in Studio to match Kolibri's Noto Sans appearance
6 participants