Commit Graph

213 Commits

Author SHA1 Message Date
Tessa Kelly
3248a71007 Convert the label helper (minus styles) 2018-06-15 09:07:50 -07:00
Tessa Kelly
fed092acea Adds Html.Styled version of html extras 2018-06-15 09:07:35 -07:00
Tessa Kelly
06651d8292 Add V2 of html extra attributes' 2018-06-15 09:02:45 -07:00
Tessa Kelly
6a7c6c2f02 Pull out and begin converting the label to the new pattern 2018-06-15 08:44:33 -07:00
Tessa Kelly
b50f566443 Pull out the styles from the stylesheet 2018-06-15 08:35:08 -07:00
Tessa Kelly
2a1eeb5522 Alias Html as RootHtml 2018-06-14 18:21:46 -07:00
Tessa Kelly
ee26d4d62b Reorder for my own understanding 2018-06-14 18:19:52 -07:00
Tessa Kelly
994b058bb6 Add new version of the checkbox 2018-06-14 18:15:04 -07:00
Stoeffel
88821f4230 render markdown in button labels 2018-06-12 11:24:05 -07:00
Brooke
f84569ad7d fix height regression on input 2018-06-11 15:42:25 -07:00
Brooke
f621daa73f fix height regression 2018-06-11 15:35:45 -07:00
Brooke
5b0fd8290e fix textarea height 2018-06-11 15:23:25 -07:00
Brooke
9404102758 use override-sass-styles on textarea v3 2018-06-11 15:23:25 -07:00
Brooke
d3c754be16 override sass styles from monolith 2018-06-11 15:23:24 -07:00
Luke Westby
38ca396ac8
Updates to TextArea (#70)
* update textarea js code and make it npm-ready

* use an attribute instead so dom debugging is easier

* use data- attribute to be I D I O M A T I C

* version the custom element

* include marica's resize logic improvements

* changes to elm module

* clean up styleguide build and use v3 in styleguide
2018-06-11 11:08:49 -07:00
Brooke
b341193678 expose TextArea.V3 and TextInput.V3 2018-05-31 15:07:15 -07:00
Brooke
179f9d3054 use new elm-css in (NEW) TextArea.V3 2018-05-31 15:02:38 -07:00
Brooke
fe0466d3f4 use new elm-css for TextInput V3 2018-05-31 14:43:24 -07:00
Jasper Woudenberg
af5cdad561 Expose InputStyles module
We have some custom input widgets in other code bases that make use of
these styles, hence the need to expose them.
2018-05-30 17:30:58 -07:00
Jasper Woudenberg
6e85f8fc0f Expose Nri.Ui.InputStyles 2018-05-30 17:22:17 -07:00
Jasper Woudenberg
b170638ec6 Add back min height for writing text areas 2018-05-30 10:56:03 -07:00
Jasper Woudenberg
a56dc32d10 Merge branch 'master' into textarea-v2-minimum-height 2018-05-29 14:52:01 -07:00
Brooke
1cf95c84d9 always center writing input 2018-05-29 10:52:39 -07:00
Brooke
3c4a0fd201 tweak writing styles to work with textarea and textinput 2018-05-29 10:52:39 -07:00
Brooke
22d856ceca add Nri.Ui.TextInput.V2 with writing style (styling not perfect yet) 2018-05-29 10:52:39 -07:00
Brooke
82b75836d1 fix box-sizing css attribute 2018-05-29 10:52:39 -07:00
Tereza Sokol
816904c048 fix trailing blank 2018-05-29 09:30:00 -05:00
Tereza Sokol
de6015eb54 Add max width on details to improve readability 2018-05-29 09:30:00 -05:00
Marica Odagaki
87792bedff Combine autoResize and minimumHeight into height
Writing the changelog drove home the fact that minimumHeight
only makes sense when the textarea is set to auto-resize.
2018-05-23 17:41:49 -08:00
Marica Odagaki
cbb7d9e72c Explain more of the usecase 2018-05-23 17:41:49 -08:00
Marica Odagaki
6ea8d7829e Workaround for V2.writing ignoring minimumHeight 2018-05-23 17:41:49 -08:00
Marica Odagaki
942865b140 Make it easier to specifiy the minimumHeight while reducing freedom
If we want to allow specifying arbitrary height as the minimum height
in the future, it could be added as `Custom someUnit` in the future.
2018-05-23 17:41:49 -08:00
Marica Odagaki
55acc3e406 Note about V2.writing ignoring minimumHeight 2018-05-23 15:21:55 -08:00
Marica Odagaki
aa3b49ba2b Remove comment that has been addressed 2018-05-23 14:24:54 -08:00
Jasper Woudenberg
f324bdd59d Update V2 changelog notes 2018-05-22 12:28:36 +02:00
Jasper Woudenberg
1cd748aeab Remove use of deprecated elm-css module 2018-05-18 11:23:32 +02:00
Jasper Woudenberg
2a77a03efc Migrate TextArea.V2 to Html.Styled
This does not actually migrate the styles themselves yet, it just
changes the Html type of the `TextArea` exposed from the module.
2018-05-18 10:35:31 +02:00
Jasper Woudenberg
c43dca766b Remove some imports exposing (..)
To make it easier to understand where a value is coming from.

Also, we should now be in a better place to replace `Html` in favor of
`Html.Styled`.
2018-05-18 10:26:08 +02:00
Marica Odagaki
e680662c71 TextArea.V2: adds ability to specify the minimum height 2018-05-17 17:25:17 -07:00
Jasper Woudenberg
15c398502b Add missing doc comment 2018-05-17 12:18:52 +02:00
Jasper Woudenberg
49fbba3650
Merge branch 'master' into add-custom-button 2018-05-17 09:52:50 +02:00
Jasper Woudenberg
93f101abaf
Merge branch 'master' into ink--upgrade-text 2018-05-17 08:38:47 +02:00
Tessa Kelly
3253e3466d Add V2 of Nri.Ui.Text using Html.Styled 2018-05-16 17:09:17 -07:00
James Gary
c6ec4a8dd1 Increase contrast of table text color
- See https://app.zeplin.io/project/5973fb495395bdc871ebb055/screen/597bbea5823b053d617f725e?did=5af9ed2a7b0cf6c245a076e5&cmid=5af9ed2a7b0cf6c245a076e6
2018-05-15 12:05:40 -07:00
Michael Glass
4d1e1351f1
add customButton which accepts attributes 2018-05-12 13:59:05 +02:00
James Gary
37c4d95bc3 Add mastery badge icon 2018-05-11 13:39:15 -07:00
Tereza Sokol
a4c3992123
... Foolish mistake corrected
SPAs don't use the url...........
2018-05-11 11:44:42 +02:00
Tereza Sokol
5e685cf2f9 Add link spa to icon module 2018-05-10 17:46:40 +02:00
Jasper Woudenberg
8276fc22fa Remove some superfluous styling 2018-05-03 14:34:37 +02:00
Jasper Woudenberg
fa34fd7bd4 Pull in new changes from the monolith
Also add a `noPermission` page.
2018-05-03 14:32:26 +02:00
Jasper Woudenberg
d6a10d1ed4 Merge branch 'master' into extract-nri-page 2018-05-03 14:19:22 +02:00
Jasper Woudenberg
44c58c2bc0 Merge branch 'master' into table-v2 2018-05-03 09:39:18 +02:00
Jasper Woudenberg
5d5ef7f5d4 Add note on upgrading from Nri.Ui.Table.V1 2018-05-03 09:36:57 +02:00
Jasper Woudenberg
243cae984a 💀 Remove dead code 2018-05-03 09:24:42 +02:00
Jasper Woudenberg
e3e4a0e66f Add Button.linkWithTracking
This function was forgotten as the `Nri.Button` module was extracted.
2018-05-02 11:36:29 +02:00
Jasper Woudenberg
e1fca3dfa7 Add box-sizing: border-box to button containers
In the monolith we inherit this property from a CSS reset, but we cannot
count on that being present in every application using this library, so
also setting this property explicitly.
2018-05-01 17:51:50 +02:00
Jasper Woudenberg
b262a7a108 Horizontally center page content 2018-05-01 17:44:55 +02:00
Jasper Woudenberg
982fbc6f24 Extract Nri.Page from monolith
This contains premade error pages.
2018-05-01 17:20:57 +02:00
Jasper Woudenberg
181697d8bb Reinstitute padding for loading styles
The table loading styles require the paddings that are removed for the
general table case. That's okay: the table loading styles do not support
putting custom content in cells, and so the option of setting custom
paddings for content will not be missed.
2018-04-30 15:07:22 +02:00
Jasper Woudenberg
66c079f3cc Vertically align content in table cells by default
The previous removal of default table cell padding makes the default
alignment in content look weird. Adding a vertical alignment property
fixes this.

We previously removed the default padding because it did not play nice
with designs requiring less padding. Does the addition of vertical
alignment create a similar problem? I'd argue now. Padding cannot be
easily countered. Vertical alignment can easily be countered by
embedding div's in the cells with custom styling.
2018-04-30 14:08:04 +02:00
Jasper Woudenberg
6b9e35071b Remove default cell padding
We've run into a situation in CCS where the default padding added to
cells are to large. Considering it is much harder to remove a padding
from the outside then it is to add one, this commit removes the default
cell padding for tables.
2018-04-30 13:58:54 +02:00
Jasper Woudenberg
81fa1b0bc6 Update classnames for V2 2018-04-30 13:56:56 +02:00
Jasper Woudenberg
e87ff67a5c Update module name in some comments 2018-04-30 13:17:41 +02:00
Jasper Woudenberg
3e59b7c825 Port over the latest Nri.Button from the monolith 2018-04-30 12:58:42 +02:00
Jasper Woudenberg
dc87a14925
Merge branch 'master' into table-v2 2018-04-30 10:19:11 +02:00
Jasper Woudenberg
8f344774c3 Switch Table.V2 over to Html.Styled
This is probably better then relying on more deprecated elm css
functionality, like we were before.
2018-04-25 19:25:34 +02:00
Jasper Woudenberg
de10ffb43e New table version that takes any css width
This way you're not limited to creating tables with fixed-width columns.
This also makes the table take up the maximum available width space by
default.
2018-04-25 19:10:34 +02:00
Juan Edi
88ed81cfc0 Add guidedWrite icon 2018-04-25 13:54:14 -03:00
Jasper Woudenberg
540b5b4e71 Make some styles of the table explicit
The table styles are currently depending on some browser styles. If
those are disabled (for instance using a reset.css file), then tables do
not look correct. This makes explicit styles that are currently coming
from the browser.
2018-04-25 14:19:28 +02:00
Jasper Woudenberg
979a49002f Expose Nri.Ui.Table.V1 2018-04-24 18:45:53 +02:00
Jasper Woudenberg
4c8f2cae89 Add keyframe animations to styleguide example
Also provide a function for easily embedding said keyframes into a page.
2018-04-24 18:36:37 +02:00
Jasper Woudenberg
5580edaa7d Collapse border tables
In the monolith we seem to inherit this bit of styling from somewhere.
For `noredink-ui` we need to make it explicit.
2018-04-24 17:56:43 +02:00
Jasper Woudenberg
4920316a54 Extract Nri.Table into noredink-ui 2018-04-24 17:43:26 +02:00
Hardy Jones
1647b2f358
Make selects expand to the full width of parent
There are places where we need the select to be as wide as possible.
Since it seems like a sensible default to have all the selects expand,
we take that approach.

If we find out that this is harder, we can release use the old version.
2018-04-18 07:58:19 -07:00
Hardy Jones
5036c63e28
Merge branch 'master' into extract-select 2018-04-17 07:56:22 -07:00
Hardy Jones
4977d00361
Style the selector
We need some styling that was implicit in the monolith.
2018-04-16 15:50:28 -07:00
Hardy Jones
144eff1af7
Un-pipeline niceId
It's a bit clearer what we're doing in `niceId`
if we remove the indirection of the pipeline.
2018-04-16 15:43:06 -07:00
Hardy Jones
bffaae0e3f
Extract Nri.Select from the monolith 2018-04-16 15:43:01 -07:00
Hardy Jones
199689abd0
Style the dropdown 2018-04-16 13:12:17 -07:00
Hardy Jones
1b86ec442f
Extract Nri.Dropdown to noredink-ui
There are a couple of minor differences here.
Some of the dependencies we had were inlined.
_Should_ be no behavioral changes though.
2018-04-16 12:19:43 -07:00
James Gary
a4d3448b47 Add skip icon 2018-04-04 09:34:42 -07:00
Tessa Kelly
eb3d9f038c Adds sumitting, rating, and revising helpers 2018-04-02 17:17:42 -07:00
Hardy Jones
e5a56486d7
Allow segmented control to expand to parent's width
We want to allow the control to take up the full width of the parent.
This will most likely break something if you try to upgrade directly.
Should be fixable by putting the control in an element with
the appropriate width.
2018-03-30 09:10:33 -07:00
Hardy Jones
d4d6991643
Style the segmented control tabs directly
tl;dr; Use a class for each variant instead of overriding one variant.

Before, we relied on CSS specificity in an unclear way.
The `Focused` class was applying properly because it was ordered later
than the `Tab` class in the stylesheet.
The ordering that is important is the ordering in `styles` value.
Since `elm-css` generates the stylesheet in the order of the lists,
the `Focused` rule would be generated after the `Tab` rule.
Meaning the `Focused` rule would take precedence over the `Tab` rule
if an element had both classes as it was defined later in the stylesheet.

There are some concerns with this approach:
1. It's not readily apparent that the ordering in `styles` is important.
    It is pretty easy to change the ordering of the list
    and have it break the styling.
2. We rely on `elm-css` to generate the stylesheet in a specific order.
    If it changes the order of rules it generates,
    we're almost surely going to break the styling.
3. Altering styles for tabs that are not focused is even less intuitive.
    Since the specificity is the same,
    you might not know why a given rule applies (or doesn't apply).

Rather, we can eschew the specificity/precedence issues
by applying a different class to each tab.
The stuff that is the same can stay on the `Tab` class,
and the stuff that differs can be on different classes.

We are now able to set the background color for `Unfocused` tabs.
We were relying on the control being placed atop a white background.
When we moved to using the control atop a non-whitebackground,
it showed that the `Unfocused` tabs had a transparent backround.
All of our designs show `Unfocused` tabs with a white backround.

See https://github.com/NoRedInk/noredink-ui/pull/14 for more information.
2018-03-30 09:10:33 -07:00
Stoeffel
4fcf54727e fix namespace of v4 2018-03-30 16:05:21 +02:00
Stoeffel
b7dbbfffd3 rename to CssClass to avoid bumping to 5.0.0 2018-03-30 16:05:03 +02:00
Stoeffel
6559a32023 expose css classes 2018-03-30 15:57:40 +02:00
Stoeffel
ac49bb373e exposes CssClasses type 2018-03-30 13:17:34 +02:00
Jasper Woudenberg
0b62490bcf
Merge branch 'master' into separate-icon-functions 2018-03-30 08:00:09 +02:00
Brooke
bd28ec2420 make Nri.Ui.styled compatible with Accessibility.Styled 2018-03-29 13:06:45 -07:00
Jasper Woudenberg
6f6f17cc00 New SegmentedControl that uses latest Icon
This change allows SegmentedControl to no longer needs to take a record
with all icon assets. It's the construction of the `IconType` that now
requires an asset, which one depends on the icon being constructed.
2018-03-29 10:16:27 +02:00
Jasper Woudenberg
09de05c06e New Icon module with a function per icon
The purpose of this change is to allow each icon to list its asset
dependencies separately. This allows services consuming the icon library
to only provide those icons that are actually used.
2018-03-29 10:16:02 +02:00
Hardy Jones
fb2dbbfb47
Extract updated segmented control from the monolith
This version is like `Nri.Ui.SegmentedControl.V1` with the icon changes.
It has the fix for `box-sizing`.

All the other caveats from `Nri.Ui.SegmentedControl.V1`
(if there were any) apply here as well.
2018-03-28 18:20:58 -07:00
Hardy Jones
0a75e8229b
Extract Nri.Icon from the monolith
The recommendation is to break the styles API rather than the view API
when moving something out of the monolith into this repo.

`Nri.Icon` is not really setup for that sort of breakage.
If we would prefer to have the styles break rather than the view,
that will take more work.
Work that can be done independent of the extraction.

The transition in the monolith ought to look something like:

```elm
module Nri.Icon exposing (..)

import Html exposing (Html)
import Nri.SvgSprite
import Nri.Ui.Icon.V1 exposing (Assets, IconType)

icon : { alt : String, icon : IconType } -> Html msg
icon config =
  Nri.Ui.Icon.V1.icon assets

assets : Assets {}
assets =
  { activity = Nri.SvgSprite.activity
  , arrowDown = Nri.SvgSprite.arrowDown
  , attention_svg = Nri.Assets.attention_svg
  ...
  }
```

So hopefully, the change is still very small on the monolith side.

There's maybe a bigger concern than which API breaks.
`Nri.Icon` has some behavior for a11y.
We could definitely change the internals over during the extraction.
But, since all of these changes are value-level changes,
it's very likely that we'll break something in the process.
That's a bigger concern because instead of affecting
the handful of Engineers working at NRI,
we would be affecting the millions of people using the site.

We shouldn't fear making those kinds of changes.
However, we should make them when we can give them the appropriate
attention they deserve.
Not when one person is trying to move as fast as possible to avoid
race conditions of moving modules between repos.
2018-03-28 18:20:16 -07:00
Hardy Jones
a00262c3aa
Set the backround color directly
The `initial` `background-color` is `transparent`.
We got away with not setting the background color before
as we were always using segmented controls on top of white backgrounds.

We now want to use a segmented control atop a non-white background,
so we have to explicitly set the `background-color`.
2018-03-26 19:53:33 -07:00
Hardy Jones
7ebb488786
Style the tabs directly
tl;dr; Use a class for each variant instead of overriding one variant.

Before, we relied on CSS specificity in an unclear way.
The `Focused` class was applying properly because it was ordered later
than the `Tab` class in the stylesheet.
The ordering that is important is the ordering in `styles` value.
Since `elm-css` generates the stylesheet in the order of the lists,
the `Focused` rule would be generated after the `Tab` rule.
Meaning the `Focused` rule would take precedence over the `Tab` rule
if an element had both classes as it was defined later in the stylesheet.

There are some concerns with this approach:
1. It's not readily apparent that the ordering in `styles` is important.
    It is pretty easy to change the ordering of the list
    and have it break the styling.
2. We rely on `elm-css` to generate the stylesheet in a specific order.
    If it changes the order of rules it generates,
    we're almost surely going to break the styling.
3. Altering styles for tabs that are not focused is even less intuitive.
    Since the specificity is the same,
    you might not know why a given rule applies (or doesn't apply).

Rather, we can eschew the specificity/precedence issues
by applying a different class to each tab.
The stuff that is the same can stay on the `Tab` class,
and the stuff that differs can be on different classes.
2018-03-26 19:53:19 -07:00
Hardy Jones
c838f4f322
Merge pull request #11 from NoRedInk/add-segmented-control
Add `SegmentedControl`
2018-03-26 16:23:10 -07:00
Brooke
5147e5c056 add Nri.Ui.styled 2018-03-26 12:08:16 -07:00
Jasper Woudenberg
af6fb30993 Add box-sizing attribute to segmented control
On the monolith we have a base css file somewhere that adds this
property by default. In this package we don't (and even if we did, we
couldn't bundle it with the elm code), so this commit adds the property
manually on a div that needs it.
2018-03-26 10:21:23 +02:00
Hardy Jones
3b99ba56a7
Add SegmentedControl 2018-03-23 19:05:34 -07:00