noredink-ui/styleguide-app/Examples/Icon.elm

122 lines
7.3 KiB
Elm
Raw Normal View History

2018-06-22 20:39:00 +03:00
module Examples.Icon exposing (example)
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-29 03:34:56 +03:00
{-|
@docs example, styles
-}
2019-10-01 03:16:29 +03:00
import Examples.IconHelpers exposing (deprecatedIcon, viewIcon, viewIconSection)
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-29 03:34:56 +03:00
import ModuleExample exposing (Category(..), ModuleExample)
2019-10-01 02:07:13 +03:00
import Nri.Ui.AssignmentIcon.V1 as AssignmentIcon
2019-10-01 03:10:09 +03:00
import Nri.Ui.Colors.V1 as Colors
import Nri.Ui.Icon.V5 as Icon
2019-10-01 03:13:00 +03:00
import Nri.Ui.Svg.V1 as Svg
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-29 03:34:56 +03:00
{-| -}
example : ModuleExample msg
example =
2019-10-01 03:16:46 +03:00
{ name = "Nri.Ui.Icon.V5"
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-29 03:34:56 +03:00
, category = Icons
, content =
2018-06-22 20:41:31 +03:00
[ viewIconSection "Mastery Icons"
2019-10-01 03:10:09 +03:00
[ deprecatedIcon { icon = Icon.gardening, background = Colors.blue, alt = "Gardening" }
, deprecatedIcon { icon = Icon.highFive, background = Colors.blue, alt = "HighFive" }
, deprecatedIcon { icon = Icon.okay, background = Colors.blue, alt = "Okay" }
, deprecatedIcon { icon = Icon.thumbsUp, background = Colors.blue, alt = "ThumbsUp" }
, deprecatedIcon { icon = Icon.masteryBadge, background = Colors.frost, alt = "Badge " }
2018-06-22 20:39:00 +03:00
]
, viewIconSection "Stars and Flags"
2019-10-01 03:10:09 +03:00
[ deprecatedIcon { icon = Icon.starred, background = Colors.frost, alt = "Starred" }
, deprecatedIcon { icon = Icon.notStarred, background = Colors.frost, alt = "NotStarred" }
, deprecatedIcon { icon = Icon.flag, background = Colors.frost, alt = "Flag" }
2018-06-22 20:39:00 +03:00
]
2019-10-01 03:10:09 +03:00
, viewIconSection "Nri.Ui.AssignmentIcon.V1."
2019-10-01 03:13:00 +03:00
[ ( "diagnostic", Svg.toHtml AssignmentIcon.diagnostic )
, ( "practice", Svg.toHtml AssignmentIcon.practice )
, ( "quiz", Svg.toHtml AssignmentIcon.quiz )
, ( "quickWrite", Svg.toHtml AssignmentIcon.quickWrite )
, ( "guidedDraft", Svg.toHtml AssignmentIcon.guidedDraft )
, ( "peerReview", Svg.toHtml AssignmentIcon.peerReview )
, ( "selfReview", Svg.toHtml AssignmentIcon.selfReview )
]
2018-06-22 20:39:00 +03:00
, viewIconSection "Assignment Types"
2019-10-01 03:10:09 +03:00
[ deprecatedIcon { icon = Icon.submitting, background = Colors.frost, alt = "Submitting" }
, deprecatedIcon { icon = Icon.rating, background = Colors.frost, alt = "Rating" }
, deprecatedIcon { icon = Icon.revising, background = Colors.frost, alt = "Revising" }
, deprecatedIcon { icon = Icon.assignmentTypeWritingCycle, background = Colors.frost, alt = "WritingCycle" }
, deprecatedIcon { icon = Icon.writingAssignment, background = Colors.frost, alt = "WritingAssignment" }
2018-06-22 20:39:00 +03:00
]
2018-06-22 21:24:06 +03:00
, viewIconSection "Student Assignment Actions"
2019-10-01 03:10:09 +03:00
[ deprecatedIcon { icon = Icon.assignmentStartButtonPrimary, background = Colors.frost, alt = "Start primary" }
, deprecatedIcon { icon = Icon.assignmentStartButtonSecondary, background = Colors.frost, alt = "Start secondary" }
2018-06-22 21:24:06 +03:00
]
, viewIconSection "Teacher Assignment Actions"
2019-10-01 03:10:09 +03:00
[ deprecatedIcon { icon = Icon.unarchive, background = Colors.frost, alt = "Unarchive" }
, deprecatedIcon { icon = Icon.share, background = Colors.frost, alt = "Share" }
, deprecatedIcon { icon = Icon.seeMore, background = Colors.frost, alt = "See More" }
, deprecatedIcon { icon = Icon.preview, background = Colors.frost, alt = "Preview" }
, deprecatedIcon { icon = Icon.performance, background = Colors.frost, alt = "Performance" }
, deprecatedIcon { icon = Icon.openClose, background = Colors.frost, alt = "OpenClose" }
, deprecatedIcon { icon = Icon.download, background = Colors.frost, alt = "Download" }
2018-06-22 20:39:00 +03:00
]
, viewIconSection "Edit"
2019-10-01 03:10:09 +03:00
[ deprecatedIcon { icon = Icon.edit, background = Colors.frost, alt = "Edit" }
, deprecatedIcon { icon = Icon.editWriting, background = Colors.frost, alt = "EditWriting" }
2018-06-22 20:39:00 +03:00
]
, viewIconSection "Humans"
2019-10-01 03:10:09 +03:00
[ deprecatedIcon { icon = Icon.class, background = Colors.frost, alt = "Class" }
, deprecatedIcon { icon = Icon.leaderboard, background = Colors.frost, alt = "Leaderboard" }
, deprecatedIcon { icon = Icon.personBlue, background = Colors.frost, alt = "PersonBlue" }
2018-06-22 20:39:00 +03:00
]
, viewIconSection "Social Media"
2019-10-01 03:10:09 +03:00
[ deprecatedIcon { icon = Icon.facebook, background = Colors.frost, alt = "Facebook" }
, deprecatedIcon { icon = Icon.twitter, background = Colors.frost, alt = "Twitter" }
, deprecatedIcon { icon = Icon.clever, background = Colors.frost, alt = "Clever" }
2018-06-22 20:39:00 +03:00
]
, viewIconSection "Arrows and Carets"
2019-10-01 03:10:09 +03:00
[ deprecatedIcon { icon = Icon.arrowDown, background = Colors.frost, alt = "ArrowDown" }
, deprecatedIcon { icon = Icon.sortArrow, background = Colors.frost, alt = "SortArrow" }
2018-06-22 20:39:00 +03:00
]
, viewIconSection "Checkmarks"
2019-10-01 03:10:09 +03:00
[ deprecatedIcon { icon = Icon.checkMarkSvg, background = Colors.frost, alt = "CheckMarkSvg" }
2018-06-22 20:39:00 +03:00
]
, viewIconSection "Xs"
2019-10-01 03:10:09 +03:00
[ deprecatedIcon { icon = Icon.xSvg, background = Colors.frost, alt = "XSvg" }
2018-06-22 20:39:00 +03:00
]
, viewIconSection "Bangs"
2019-10-01 03:10:09 +03:00
[ deprecatedIcon { icon = Icon.exclamation, background = Colors.frost, alt = "Exclamation" }
, deprecatedIcon { icon = Icon.attention, background = Colors.blue, alt = "Attention" }
2018-06-22 20:39:00 +03:00
]
, viewIconSection "Bulbs and Tips"
2019-10-01 03:10:09 +03:00
[ deprecatedIcon { icon = Icon.bulb, background = Colors.frost, alt = "Bulb" }
, deprecatedIcon { icon = Icon.lightBulb, background = Colors.frost, alt = "LightBulb" }
, deprecatedIcon { icon = Icon.helpSvg, background = Colors.frost, alt = "Help" }
2018-06-22 20:39:00 +03:00
]
, viewIconSection "Locks and keys"
2019-10-01 03:10:09 +03:00
[ deprecatedIcon { icon = Icon.key, background = Colors.frost, alt = "Key" }
, deprecatedIcon { icon = Icon.lock, background = Colors.frost, alt = "Lock" }
2018-06-22 20:39:00 +03:00
]
, viewIconSection "Time"
2019-10-01 03:10:09 +03:00
[ deprecatedIcon { icon = Icon.calendar, background = Colors.frost, alt = "Calendar" }
, deprecatedIcon { icon = Icon.clock, background = Colors.frost, alt = "Clock" }
2018-06-22 20:39:00 +03:00
]
, viewIconSection "Uncategorized (SVGs)"
2019-10-01 03:10:09 +03:00
[ deprecatedIcon { icon = Icon.activity, background = Colors.frost, alt = "Activity" }
, deprecatedIcon { icon = Icon.compassSvg, background = Colors.frost, alt = "CompassSvg" }
, deprecatedIcon { icon = Icon.document, background = Colors.frost, alt = "Document" }
, deprecatedIcon { icon = Icon.flipper, background = Colors.frost, alt = "Flipper" }
, deprecatedIcon { icon = Icon.footsteps, background = Colors.frost, alt = "Footsteps" }
, deprecatedIcon { icon = Icon.gear, background = Colors.frost, alt = "Gear" }
, deprecatedIcon { icon = Icon.pen, background = Colors.frost, alt = "Pen" }
, deprecatedIcon { icon = Icon.newspaper, background = Colors.frost, alt = "Newspaper" }
, deprecatedIcon { icon = Icon.sort, background = Colors.frost, alt = "Sort" }
, deprecatedIcon { icon = Icon.speedometer, background = Colors.frost, alt = "Speedometer" }
, deprecatedIcon { icon = Icon.skip, background = Colors.frost, alt = "Skip" }
, deprecatedIcon { icon = Icon.equalitySign, background = Colors.frost, alt = "EqualitySign" }
, deprecatedIcon { icon = Icon.logo, background = Colors.frost, alt = "Logo" }
2018-06-22 20:39:00 +03:00
]
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-29 03:34:56 +03:00
]
}