-
Notifications
You must be signed in to change notification settings - Fork 4
banner updates #143
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
Open
kimispencer
wants to merge
19
commits into
main
Choose a base branch
from
kimi/banner-update
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
banner updates #143
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
fa86210
Add Banner component
arthurxavierx ba0cda6
Finish documentation of banner component
arthurxavierx c363f11
Fix styling of dismiss button
arthurxavierx 12e0ab0
Code review suggestion
arthurxavierx f96fc10
Merge branch 'master' into arthur/banner
kimispencer c34920e
Banner updates
kimispencer b2ea6ab
action button alignment variations
kimispencer 7e30a9d
Merge branch 'master' into kimi-banner-update
kimispencer cba6358
cleanup
kimispencer c40f66c
style fixes
kimispencer c798475
code review
kimispencer 5901b21
style review
kimispencer b033b52
dismissable button fix
kimispencer 1850b55
code reivew fixes
kimispencer 1a719cb
cleanup + wrap up fixes
kimispencer 89e7ee2
dismiss button
kimispencer 2de0742
action button alignment
kimispencer b003525
actionBanner alignments
kimispencer 3958aab
actionBanner + dismissable
kimispencer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
module Lumi.Components2.Examples.Banner where | ||
|
||
import Prelude | ||
|
||
import Data.Array (intercalate) | ||
import Data.Maybe (Maybe(..)) | ||
import Lumi.Components (LumiProps) | ||
import Lumi.Components.Button as Button | ||
import Lumi.Components.Example (example) | ||
import Lumi.Components.Images (avatar) | ||
import Lumi.Components.Size (large) | ||
import Lumi.Components.Spacing (Space(..), vspace) | ||
import Lumi.Components.Text (h2_, p_, subsectionHeader_) | ||
import Lumi.Components2.Banner as Banner | ||
import Lumi.Styles.Box (FlexAlign(..), _alignSelf) | ||
import React.Basic (JSX, fragment) | ||
import React.Basic.DOM as R | ||
|
||
docs :: JSX | ||
docs = | ||
intercalate (vspace S8) | ||
[ p_ "Banners are small pieces of informative content that draw the attention of the user through color and that may require user action." | ||
|
||
, h2_ "round (default), spaced list, non-dismissable" | ||
, example | ||
$ fragment | ||
$ allColors | ||
$ _ { content = loremIpsum_ } | ||
|
||
, h2_ "round (default), spaced list, dismissable" | ||
, example | ||
$ fragment | ||
$ allColors | ||
$ _ { content = loremIpsum_ | ||
, dismissable = true | ||
} | ||
|
||
, h2_ "round (default), spaced list, non-dismissable with icon" | ||
, example | ||
$ fragment | ||
$ allColors | ||
$ _ { content = loremIpsum_ | ||
, icon = bannerIcon | ||
} | ||
|
||
, h2_ "round (default), spaced list, dismissable with icon" | ||
, example | ||
$ fragment | ||
$ allColors | ||
$ _ { dismissable = true | ||
, content = loremIpsum_ | ||
, icon = bannerIcon | ||
} | ||
|
||
, h2_ "round (default), spaced list, dismissable with title" | ||
, example | ||
$ fragment | ||
$ allColors | ||
$ _ { dismissable = true | ||
, title = bannerTitle | ||
, content = loremIpsum | ||
} | ||
|
||
, h2_ "action banner, round (default), spaced list, non-dismissable with icon" | ||
, example | ||
$ fragment | ||
$ allColors | ||
$ Banner.actionBanner simpleActions | ||
$ _ { content = loremIpsum_ | ||
, icon = bannerIcon | ||
} | ||
|
||
, h2_ "action banner, round (default), spaced list, non-dismissable" | ||
, example | ||
$ fragment | ||
$ allColors | ||
$ Banner.actionBanner simpleActions | ||
$ _ { content = loremIpsum_ } | ||
|
||
, h2_ "action banner, round (default), spaced list, non-dismissable" | ||
, example | ||
$ fragment | ||
$ allColors | ||
$ Banner.actionBanner twoButtonActions | ||
$ _ { content = loremIpsum_ } | ||
|
||
, h2_ "action banner, round (default), spaced list, non-dismissable" | ||
, example | ||
$ fragment | ||
$ allColors | ||
$ Banner.actionBanner actions | ||
$ _ { content = loremIpsum_ } | ||
|
||
, h2_ "action banner, round (default), spaced list, dismissable" | ||
, example | ||
$ fragment | ||
$ allColors | ||
$ Banner.actionBanner simpleActions | ||
$ _ { content = loremIpsum_ | ||
, dismissable = true | ||
} | ||
] | ||
where | ||
allColors :: (LumiProps Banner.BannerProps -> LumiProps Banner.BannerProps) -> Array JSX | ||
allColors props = | ||
[ Banner.banner | ||
$ _alignSelf Stretch | ||
$ Banner._listSpaced | ||
$ props | ||
, Banner.banner | ||
$ _alignSelf Stretch | ||
$ Banner._listSpaced | ||
$ Banner.primary | ||
$ props | ||
, Banner.banner | ||
$ _alignSelf Stretch | ||
$ Banner._listSpaced | ||
$ Banner.active | ||
$ props | ||
, Banner.banner | ||
$ _alignSelf Stretch | ||
$ Banner._listSpaced | ||
$ Banner.warning | ||
$ props | ||
, Banner.banner | ||
$ _alignSelf Stretch | ||
$ Banner._listSpaced | ||
$ Banner.error | ||
$ props | ||
] | ||
|
||
loremIpsum_ :: Array JSX | ||
loremIpsum_ = [ R.text "Lorem ipsum dolor sit amet, consectetur adipiscing elit." ] | ||
|
||
loremIpsum :: Array JSX | ||
loremIpsum = | ||
[ R.text "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam varius erat a purus fermentum luctus. Sed porta nisi eget mauris facilisis, a accumsan erat feugiat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Pellentesque maximus mauris nulla." | ||
] | ||
|
||
bannerTitle :: Maybe JSX | ||
bannerTitle = | ||
Just $ subsectionHeader_ "Lorem ipsum dolor sit amet" | ||
|
||
bannerIcon :: Maybe JSX | ||
bannerIcon = | ||
Just $ avatar | ||
{ image: R.img { src: "https://s3.amazonaws.com/lumi-blog/avatars/_x600/flexo.jpg" } | ||
, size: large | ||
, style: R.css { height: "40px", width: "40px" } | ||
} | ||
|
||
simpleActions :: Array JSX | ||
simpleActions = | ||
[ Button.button Button.primary | ||
{ title = "Submit" | ||
} | ||
] | ||
|
||
twoButtonActions :: Array JSX | ||
twoButtonActions = | ||
[ Button.button Button.secondary | ||
{ title = "Clear" | ||
, style = R.css { backgroundColor: "transparent" } | ||
} | ||
, Button.button Button.primary | ||
{ title = "Submit" | ||
} | ||
] | ||
|
||
actions :: Array JSX | ||
actions = | ||
[ Button.button Button.primary | ||
{ title = "Try again" | ||
} | ||
, Button.button Button.linkStyle | ||
{ title = "View error" | ||
} | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we also want an example/test with actions and the dismiss button.