-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add demo component src / basic demo page to web #5
Add demo component src / basic demo page to web #5
Conversation
Squashed commit of the following: commit 38df3b6 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Tue Oct 25 09:12:14 2016 -0700 Fix size prop in button demo component commit 7120e0d Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Tue Oct 25 09:10:43 2016 -0700 Add analytics for demo hash links + Also fixed some indentation issues commit a55b630 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Tue Oct 25 08:37:38 2016 -0700 Add analytics handlers for external links commit ebe34b7 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Mon Oct 24 15:36:07 2016 -0700 Bump version commit 54b02b9 Merge: aa85533 58682a4 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Mon Oct 24 15:35:17 2016 -0700 Merge remote-tracking branch 'upstream/master' into gh-pages commit aa85533 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Mon Oct 24 11:29:45 2016 -0700 Update favicons commit 5170c1b Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Mon Oct 24 11:29:39 2016 -0700 Add attribution for dart / react logo usage commit 3d22dd9 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Mon Oct 24 08:03:33 2016 -0700 Minify CSS commit 3b0cddf Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 21 14:52:28 2016 -0700 Add button demo component commit 7b1a357 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 21 14:38:12 2016 -0700 Fix demo landing page card spacing commit 558aac9 Merge: dc41101 def0106 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 21 14:19:44 2016 -0700 Merge branch 'readmes' into gh-pages commit dc41101 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 21 13:57:01 2016 -0700 framework -> library commit f5042c5 Merge: 051f336 99d980d Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 21 13:54:11 2016 -0700 Merge branch 'readmes' into gh-pages # Conflicts: # pubspec.yaml commit 051f336 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 21 13:11:10 2016 -0700 Fix page title commit 75f5929 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 21 12:07:35 2016 -0700 Add ProgressBar component demo commit 7275a09 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 21 10:42:17 2016 -0700 Wire up demos landing page + Created a jekyll data structure to iterate over + Also fixed an issue with open graph url value commit add9755 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 21 07:36:56 2016 -0700 Use page.lead for og description commit ba1cda5 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 21 06:51:41 2016 -0700 Only render type attribute if its a link commit d0b7684 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 21 06:42:50 2016 -0700 Commit root packages directory for docs demos commit 0bdd8e5 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 21 06:28:38 2016 -0700 Change to https to appease gh-pages commit cf09afa Merge: 3a3e4e2 1f52f0d Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 21 05:27:11 2016 -0700 Update docs site commit 3a3e4e2 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 21 05:17:18 2016 -0700 Remove TODO url commit a0b9497 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Thu Oct 20 16:15:38 2016 -0700 Initial docs site commit / testing for gh-pages branch Squashed commit of the following: commit 6b35e07 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Wed Oct 19 15:24:25 2016 -0700 Stub in dart / react component demo files commit 83e5e4d Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Wed Oct 19 15:01:21 2016 -0700 Allow scripts in head and body commit 4c656e7 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Wed Oct 19 13:09:39 2016 -0700 Update some docs urls commit d3a9074 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Tue Oct 18 13:00:51 2016 -0700 DOCS: Add home page content commit 2648fc5 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Tue Oct 18 07:51:00 2016 -0700 DOCS: Don’t write custom styles using bs classes commit a1b0caa Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Tue Oct 18 07:38:36 2016 -0700 DOCS: Improve inline svg accessibility commit 3b76751 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Tue Oct 18 07:33:58 2016 -0700 DOCS: Use SVG for navbar brand name + Otherwise we’re at the mercy of the font within the stack that the user’s system actually has, which can cause the text size to vary a great deal. commit 287a58c Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Tue Oct 18 06:59:39 2016 -0700 Improve docs site footer + Add workiva W symbol + Tweak item spacing + Add link to license commit ad994f8 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Tue Oct 18 06:58:49 2016 -0700 Make inline svgs accessible commit 6216610 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Mon Oct 17 08:28:31 2016 -0700 Add Google Analytics tracking code for docs site commit 0f668b5 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 14 16:17:19 2016 -0700 Update logo commit 7d60803 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 14 16:08:21 2016 -0700 Add home / misc page layouts and styles commit 2d75b68 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 14 10:10:47 2016 -0700 Add brand assets commit 266cc47 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Thu Oct 13 16:46:42 2016 -0700 Stub in a jekyll docs site skeleton commit 972ce7d Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Thu Oct 13 15:26:19 2016 -0700 Add twbs submodule + So we can build some docs! commit 1f52f0d Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Thu Oct 20 16:12:00 2016 -0700 Fix typo, comment out todo commit 9dc2e8b Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Thu Oct 20 16:10:47 2016 -0700 DOCS: Commit build/ dir for gh-pages push commit ff894b3 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Thu Oct 20 16:10:14 2016 -0700 DOCS: Add ListGroup / ListGroupItem / Tag components & demos commit 6b35e07 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Wed Oct 19 15:24:25 2016 -0700 Stub in dart / react component demo files commit 83e5e4d Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Wed Oct 19 15:01:21 2016 -0700 Allow scripts in head and body commit 4c656e7 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Wed Oct 19 13:09:39 2016 -0700 Update some docs urls commit d3a9074 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Tue Oct 18 13:00:51 2016 -0700 DOCS: Add home page content commit 2648fc5 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Tue Oct 18 07:51:00 2016 -0700 DOCS: Don’t write custom styles using bs classes commit a1b0caa Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Tue Oct 18 07:38:36 2016 -0700 DOCS: Improve inline svg accessibility commit 3b76751 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Tue Oct 18 07:33:58 2016 -0700 DOCS: Use SVG for navbar brand name + Otherwise we’re at the mercy of the font within the stack that the user’s system actually has, which can cause the text size to vary a great deal. commit 287a58c Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Tue Oct 18 06:59:39 2016 -0700 Improve docs site footer + Add workiva W symbol + Tweak item spacing + Add link to license commit ad994f8 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Tue Oct 18 06:58:49 2016 -0700 Make inline svgs accessible commit 6216610 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Mon Oct 17 08:28:31 2016 -0700 Add Google Analytics tracking code for docs site commit 0f668b5 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 14 16:17:19 2016 -0700 Update logo commit 7d60803 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 14 16:08:21 2016 -0700 Add home / misc page layouts and styles commit 2d75b68 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Fri Oct 14 10:10:47 2016 -0700 Add brand assets commit 266cc47 Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Thu Oct 13 16:46:42 2016 -0700 Stub in a jekyll docs site skeleton commit 972ce7d Author: Aaron Lademann <aaron.lademann@workiva.com> Date: Thu Oct 13 15:26:19 2016 -0700 Add twbs submodule + So we can build some docs!
+ These components are rendered in a more polished manner within the gh-pages branch, but our consumers should see the demos in the master branch as well if they pull the repo and serve it.
+ So that it doesn’t test the demo components
RavenNumber of Findings: 0 |
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.
Just some small changes, it was a great idea to expose these on the main repo!
@@ -0,0 +1,12 @@ | |||
part of over_react.web.demos; |
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.
Can these be there own libraries? It is the preferred way of organizing packages: https://www.dartlang.org/guides/libraries/create-library-packages#organizing-a-library-package.
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.
@jacehensley-wf yeah, they could - I just prefer parts :(
It's just much easier to ensure that all components in a lib are exposed for thinks like linking to stuff in dartdoc comments, etc... without having to flood your file with a ton of imports.
In the case of these demos - since their source code gets copied into a .html
include in the gh-pages branch, and is ultimately what is displayed in the docs - I'd like to continue using parts so that there is one line at the top of the code example, instead of 3-7 import lines. Just makes the source code examples read so much easier.
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 was more just talking about the example methods, which don't have doc comments. But I am fine with leaving it like this.
..onClick = (_) {} | ||
)('Vestibulum at eros') | ||
); | ||
|
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.
Lots of extra new lines 😄
ReactElement listGroupContextualSkinDemo() => | ||
ListGroup()( | ||
(ListGroupItem() | ||
..onClick = (_) {} |
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.
Why do these need click handlers?
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.
Oh I see to make them <button>
s
|
||
/// [className] value: 'btn-outline-primary' | ||
static const ButtonSkin PRIMARY_OUTLINE = | ||
const ButtonSkin._('PRIMARY', 'btn-outline-primary'); |
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.
#nit The outline variation names should have _OUTLINE
added to the end.
return (factory() | ||
..addProps(copyUnconsumedDomProps()) | ||
..className = _getButtonClasses().toClassName() | ||
..href = props.href |
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.
href
and target
should get forwarded automatically.
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.
Won't work since they are within ButtonProps
- which is consumed by default.
/// | ||
/// _Proxies [DomProps.target]_ | ||
@Accessor(keyNamespace: '') | ||
String target; |
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.
Could just be an abstract getter
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.
target
is not in UbiquitousDomPropsMixin
/// | ||
/// _Proxies [DomProps.href]_ | ||
@Accessor(keyNamespace: '') | ||
String href; |
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.
Could just be an abstract getter
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.
href
is not in UbiquitousDomPropsMixin
/// | ||
/// _Proxies [DomProps.target]_ | ||
@Accessor(keyNamespace: '') | ||
String target; |
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.
Could just be an abstract getter
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.
target
is not in UbiquitousDomPropsMixin
return (factory() | ||
..addProps(copyUnconsumedDomProps()) | ||
..className = _getItemClasses().toClassName() | ||
..href = props.href |
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.
href
and target
should be forwarded automatically.
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.
Won't work since they are within ListGroupItemProps
- which is consumed by default.
return factory; | ||
} | ||
|
||
ClassNameBuilder _getItemClasses() { |
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.
Why does this need to be split out into a method?
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.
@jacehensley-wf it's just an architectural thing that I've started leaning towards since consumers of WSD have been having difficulties extending components to build slight variations.
Placing the classes of a root node in a method on the component allows the consumer to then build something slightly different, simply by overriding, instead of having to nest a component within another component (which is less performant).
To make it truly worthwhile - components should also be set up like this - so that, for example, building a slightly different button (like a stateful toggle button) - can be done more easily:
@Component()
class ButtonComponent<T extends ButtonProps, S extends UiState>
extends UiStatefulComponent<T, S> {
// ...
@override
render() {
return renderButton(props.children);
}
ReactElement renderButton(dynamic children) {
BuilderOnlyUiFactory<DomProps> factory = _buttonDomNodeFactory;
return (factory()
..addProps(copyUnconsumedDomProps())
..className = getButtonClasses().toClassName()
..href = props.href
..target = props.target
..type = _type
..disabled = _isAnchorLink ? null : props.isDisabled
..addProps(ariaProps()
..disabled = _isAnchorLink ? props.isDisabled : null
)
)(children);
}
ClassNameBuilder getButtonClasses() {
return forwardingClassNameBuilder()
..add('btn')
..add('btn-block', props.isBlock)
..add('active', _isActive)
..add('disabled', props.isDisabled)
..add(props.skin.className);
}
}
@Component(subtypeOf: ButtonComponent)
class ToggleButtonComponent
extends ButtonComponent<ToggleButtonProps, ToggleButtonState> {
// ...
// Instead of having to nest a full-blown Button() component within render,
// I can just override the root node classes, and call the root node
// rendering method to get the same result.
@override
render() {
return renderButton(
[
renderInput(),
props.children
]
);
}
@override
ClassNameBuilder getButtonClasses() {
return super.getButtonClasses()
..add('btn--toggle');
}
}
I've been meaning to bring it up with the team - since I feel it's definitely something we should consider for WSD, but I haven't gotten around to it.
Also - the component example above is not in this PR, its part of the stateful toggle button component demo I started working on, but haven't had time to finish yet.
Current coverage is 96.97% (diff: 100%)@@ master #5 diff @@
==========================================
Files 26 26
Lines 1186 1186
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
Hits 1150 1150
Misses 36 36
Partials 0 0
|
+1 |
+10 |
RM +1 manually reviewed dependencies |
Prevent invalid IDE autocomplete suggestions
All the demo components that I've been building in the
gh-pages
branch should live in master as well, with a more simplistic "demo" page that can be served using nothin' butThis way, contributors / consumers can pull down the repo and play around with components built using the over_react library.
This PR is a squash of all the
gh-pages
work, excluding the jekyll / public docs site stuff, plus a newweb/index.dart
andweb/index.html
file to generate a basic demo.Testing
pub get && pub serve
.localhost:8080
in both Chrome and Chromium to verify that the demos render as expected.web/
FYA: @jacehensley-wf @greglittlefield-wf @clairesarsam-wf @joelleibow-wf