Skip to content
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

Merged
merged 7 commits into from
Oct 25, 2016

Conversation

aaronlademann-wf
Copy link
Contributor

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' but

pub serve

This 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 new web/index.dart and web/index.html file to generate a basic demo.

Testing

  1. Pull this branch, and run pub get && pub serve.
  2. Open localhost:8080 in both Chrome and Chromium to verify that the demos render as expected.
  3. Verify that test coverage statistics are not effected by these new files added to web/

FYA: @jacehensley-wf @greglittlefield-wf @clairesarsam-wf @joelleibow-wf

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
@aviary-wf
Copy link

Raven

Number of Findings: 0

Copy link
Contributor

@jacehensley-wf jacehensley-wf left a 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;
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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')
);

Copy link
Contributor

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 = (_) {}
Copy link
Contributor

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?

Copy link
Contributor

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');
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor Author

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;
Copy link
Contributor

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

Copy link
Contributor Author

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;
Copy link
Contributor

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

Copy link
Contributor Author

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;
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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() {
Copy link
Contributor

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?

Copy link
Contributor Author

@aaronlademann-wf aaronlademann-wf Oct 25, 2016

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.

@codecov-io
Copy link

codecov-io commented Oct 25, 2016

Current coverage is 96.97% (diff: 100%)

Merging #5 into master will not change coverage

@@             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          

Sunburst

Powered by Codecov. Last update 58682a4...8c4fe7d

@jacehensley-wf
Copy link
Contributor

+1

@leviwith-wf
Copy link
Contributor

  • Demos render as expected.

+10

@leviwith-wf leviwith-wf merged commit a7c5843 into Workiva:master Oct 25, 2016
@aaronlademann-wf aaronlademann-wf deleted the add-demo-components branch October 26, 2016 00:17
@colefeisthamel-wf
Copy link

RM +1 manually reviewed dependencies

aaronlademann-wf added a commit that referenced this pull request Apr 20, 2017
+ Since this is a readme file, not a GH issue… links have to be fully qualified.
+ Added link references all the way up to issue 499 to make it easier / cleaner to author within the changelog (e.g. can use `[#5]` instead of `#5`)
greglittlefield-wf pushed a commit that referenced this pull request Jun 19, 2020
Prevent invalid IDE autocomplete suggestions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants