Commit Graph

359 Commits

Author SHA1 Message Date
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
Tessa Kelly
157d7d8a49 Adds the unused bool back into the Checkbox.V1 2018-03-19 15:56:12 -07:00
Tessa Kelly
e869f064ff Adds new version of the checkbox 2018-03-19 15:55:04 -07:00
Tessa Kelly
e7b5d0e878 Nri.Colors -> Nri.Ui.Colors.V1 2018-03-16 17:33:24 -07:00
Tessa Kelly
ef390c606c Nri.Fonts -> Nri.Ui.Fonts.V1 2018-03-16 17:15:03 -07:00
Tessa Kelly
231911b013 Remove Nri.UI.Text dependency on Nri.Stylers 2018-03-16 17:12:55 -07:00
Tessa Kelly
f60277cc8b Remove dependence on Nri.Stylers for the outline 2018-03-16 17:09:37 -07:00
Tessa Kelly
bba1269d5f Remove checkbox dependence on nri stylers 2018-03-16 17:07:07 -07:00
Tessa Kelly
b72b362547 Remove dependency on NRi.Styelrs 2018-03-16 17:04:56 -07:00
Tessa Kelly
319c37caf4 Remove final dependence on Nri.Accessibility
Note: breaking API change. Better to keep the useless bool around..?
2018-03-16 16:53:43 -07:00
Tessa Kelly
ccb873e9be 💀 kill unused attribute 2018-03-16 16:47:31 -07:00
Tessa Kelly
ca240968f0 🎨 clean up uses of TextIntput.view_ 2018-03-16 16:45:24 -07:00
Tessa Kelly
15a3cb407f Replace the invisible label class with accessible html use 2018-03-16 16:44:23 -07:00
Tessa Kelly
e05c353980 Remove dependency on Nri.Accessibility from the inputs 2018-03-16 16:41:34 -07:00
Tessa Kelly
38eaee2eb2 Adds colors modules 2018-03-16 16:24:09 -07:00
Tessa Kelly
186a19e7f4 Adds user generated font style 2018-03-16 16:24:09 -07:00
Tessa Kelly
f87f3ae482 Copy over fonts from nri-elm-css 2018-03-16 16:18:18 -07:00
Jasper Woudenberg
614eb87070 Tweak styles for the CCS textarea 2018-03-13 10:18:44 +01:00
Jasper Woudenberg
cf2dec09fd Add text area for content creation
The styling used for this textarea is not quite the same as the one of
the default or writing textareas currently in use.
2018-03-13 10:08:07 +01:00
Jasper Woudenberg
f19903e3d3
Merge pull request #5 from NoRedInk/update-textarea
Update textarea
2018-03-12 20:04:18 +01:00
Tessa Kelly
75591e564c Adds whitespace preline 2018-03-08 11:29:34 -08:00
Tessa Kelly
c50081d7c5 Adds margin styles 2018-03-08 11:29:17 -08:00
Tessa Kelly
5b6de0fb53 Add styles 2018-03-07 14:27:50 -08:00
Tessa Kelly
c2e0afd10f Adds empty version of medium and small body text helpers for user-generated text 2018-03-07 14:20:56 -08:00
Jasper Woudenberg
12dd71a68d Merge branch 'master' into update-textarea 2018-03-02 09:45:27 -08:00
Stoeffel
b9c913ec19 rename to Writing and use Html.Styled 2018-03-01 13:37:58 -08:00
Jasper Woudenberg
987a5778ba Expose TextArea styles 2018-02-28 15:51:30 -08:00
Jasper Woudenberg
f6b8cdbceb Merge branch 'quiz-text' into update-textarea 2018-02-28 15:28:07 -08:00
Jasper Woudenberg
f4f24f33e8 Update TextArea to latest state in the monolith 2018-02-28 15:22:09 -08:00
Stoeffel
9c15a068f6 remove unused code 2018-02-28 14:18:40 -08:00
Stoeffel
158b23d392 expose styles 2018-02-28 14:18:32 -08:00
Stoeffel
859164516d adds first quiz text 2018-02-28 14:00:47 -08:00
Jasper Woudenberg
9987d5f738
Merge pull request #2 from NoRedInk/add-styleguide
add mini styleguide for ui components
2018-02-21 15:50:41 +01:00
Richard Feldman
0227c15f29 🎨 elm-format 2018-02-13 13:33:57 -05:00
Richard Feldman
d795923f3b Fix remaining errors 2018-02-13 13:33:57 -05:00
Richard Feldman
3f214618ac Run upgrade.sh 2018-02-13 13:33:34 -05:00
Richard Feldman
7f7735d3ef Rename things to avoid recursive naming 2018-02-13 13:28:00 -05:00
Brooke
0c33c83d73 add mini styleguide for ui components 2018-02-12 13:32:38 -08:00
Brooke
bbcd6e68e6 add Text.smallHeading 2018-02-12 12:10:57 -08:00
Jasper Woudenberg
518d276444 Use namespace unique to this package
To prevent clashes with existing namespaces in the monolith.
2018-02-01 13:52:45 +01:00
Jasper Woudenberg
7d6b499d9f Give version names to exported modules 2018-01-30 15:39:13 +01:00
Jasper Woudenberg
09272a8cd4 Pull all exposed modules on the Nri.Ui namespace
It's perhaps debateable if all these modules belong there, but it makes
sense as a first step, to avoid conflicts once we start importing this
from the monolith.
2018-01-30 15:25:29 +01:00
Jasper Woudenberg
e61c5b9127 Textarea doesn't overflow container
Because the textarea label overflowed its container it was drawn
seemingly closer to the content above it than user-set margins can
account for. This then requires the user to add additional wrappers and
margins to compensate. Drawing the textarea completely within its
enclosing container makes this unnecessary.
2018-01-25 10:23:44 +01:00
Jasper Woudenberg
731e7e0553 Format doodads using the latest elm-format 2018-01-23 11:32:50 +01:00
Jasper Woudenberg
5ef0f5174a Add Nri.Checkbox 2018-01-22 17:20:02 +01:00
Jasper Woudenberg
4431f5f0c4 Allow styles to depend on Assets
This is a necessity to allow doodads to incorporate assets like
background images into their css.

I've tried to make the change as backwards-compatible as possible,
leaving most of the existing funtions alone. The `.css` property on the
returned Styles instance still needs those asset paths though, so this
is still a major update.
2018-01-22 17:16:34 +01:00
Jasper Woudenberg
5d44e2da3f Implement new Outline styling
This doesn't include the entire spec for the new outline styling, just
the part we currently need for content creation outline draggable
creation. The additions to complete the spec look doable in the current
structure though.
2018-01-16 09:23:40 +01:00
Jasper Woudenberg
274c134fa8 Add Nri.Outline doodad 2018-01-09 18:41:28 +01:00
Jasper Woudenberg
f74c8a133f Styling tweaks for text area 2017-12-18 10:54:59 +01:00
Jasper Woudenberg
19385063aa Add back TextAreaWithOverlappingLabel
This code was already published, but not yet pushed to git.
2017-12-15 09:04:48 +01:00
Jasper Woudenberg
0ef860f008 Add Nri.Divider 2017-12-15 09:00:40 +01:00
Hardy Jones
a262a6a0bb Fix Nri.Tabs styles 2017-12-12 22:37:03 -08:00
Hardy Jones
55833118af Add Nri.Tabs 2017-12-12 22:13:32 -08:00
Hardy Jones
9447dfa961 Add missing button styles 2017-12-11 21:24:42 -08:00
Hardy Jones
4f10abf084 Add Nri.Modal 2017-12-08 21:12:21 -08:00
Jasper Woudenberg
dfe92466aa Revert "Remove Nri.Alert"
We do need it now! Getting it back.

This reverts commit 22ad1b3b7e.
2017-12-07 16:38:39 +01:00
Hardy Jones
752f64fb02 Add Nri.TextInput 2017-11-29 19:59:23 -08:00
Hardy Jones
22ad1b3b7e Remove Nri.Alert
We don't need it yet. No need to add code we don't need.
Plus, it's git, so we can always get it back...
2017-11-29 17:47:38 -08:00
Hardy Jones
ffcf90dfea Add Nri.BannerAlert
We're also missing the assets here for the same reason.
2017-11-29 17:47:11 -08:00
Hardy Jones
b3b0d36b05 Add styles
Still missing the assets.

Will have to figure out what to do in general for assets.
The concern is that we try to make assets content addressable
so we can cache them appropriately.
But we haven't done this in a place where we don't also own the assets.
2017-11-29 17:42:25 -08:00
Hardy Jones
71e00223f4 Add Nri.Alert
There's no styling yet.
Instead of styling with Sass, we should use elm-css.
2017-11-29 14:55:46 -08:00
Hardy Jones
f81e100584 Add span to Styles a b c 2017-11-16 20:34:31 -08:00
Hardy Jones
44a357b0da Add Nri.Button 2017-11-16 17:51:28 -08:00
Hardy Jones
8454442233 Add Nri.Text 2017-11-14 17:47:42 -08:00