Skip to content

Commit

Permalink
fix(expandable): add type to the button (#1982)
Browse files Browse the repository at this point in the history
* fix(expandable): add type to the button

* fix(button): add type

* fix(button): update types in components

* fix(expandable): update docs
  • Loading branch information
christiemolloy authored and mattnolting committed Jun 27, 2019
1 parent f544675 commit b0732f6
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 40 deletions.
7 changes: 7 additions & 0 deletions src/patternfly/components/Button/button.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<button class="pf-c-button{{#if button--modifier}} {{button--modifier}}{{/if}}"
{{#if button--IsSubmit}}
type="submit"
{{else if button--IsReset}}
type="reset"
{{else}}
type="button"
{{/if}}
{{#if button--attribute}}
{{{button--attribute}}}
{{/if}}>
Expand Down
29 changes: 8 additions & 21 deletions src/patternfly/components/Button/examples/button-types-example.hbs
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
{{#> button button--modifier="pf-m-primary"}}
Primary
{{/button}}
{{#> button button--modifier="pf-m-secondary"}}
Secondary
{{/button}}
{{#> button button--modifier="pf-m-tertiary"}}
Tertiary
{{#> button button--modifier="pf-m-primary" button--IsSubmit="true"}}
Submit Button
{{/button}}
{{#> button button--modifier="pf-m-danger"}}
Danger

{{#> button button--modifier="pf-m-primary" button--IsReset="true"}}
Reset Button
{{/button}}
{{#> button button--modifier="pf-m-link"}}
{{#> button-icon}}
<i class="fas fa-plus-circle" aria-hidden="true"></i>
{{/button-icon}}
Link button
{{/button}}
{{#> button button--modifier="pf-m-plain" button--attribute='aria-label="Remove"'}}
<i class="fas fa-times" aria-hidden="true"></i>
{{/button}}
{{#> button button--modifier="pf-m-inline pf-m-link"}}
Inline link button

{{#> button button--modifier="pf-m-primary"}}
Default Button
{{/button}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{#> button button--modifier="pf-m-primary"}}
Primary
{{/button}}
{{#> button button--modifier="pf-m-secondary"}}
Secondary
{{/button}}
{{#> button button--modifier="pf-m-tertiary"}}
Tertiary
{{/button}}
{{#> button button--modifier="pf-m-danger"}}
Danger
{{/button}}
{{#> button button--modifier="pf-m-link"}}
{{#> button-icon}}
<i class="fas fa-plus-circle" aria-hidden="true"></i>
{{/button-icon}}
Link button
{{/button}}
{{#> button button--modifier="pf-m-plain" button--attribute='aria-label="Remove"'}}
<i class="fas fa-times" aria-hidden="true"></i>
{{/button}}
{{#> button button--modifier="pf-m-inline pf-m-link"}}
Inline link button
{{/button}}
18 changes: 12 additions & 6 deletions src/patternfly/components/Button/examples/index.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
import React from 'react';
import Documentation from '@siteComponents/Documentation';
import Example from '@siteComponents/Example';
import ButtonTypesTemplateRaw from '!raw!./button-types-example.hbs';
import ButtonVariationTemplateRaw from '!raw!./button-variations-example.hbs';
import ButtonStatesTemplateRaw from '!raw!./button-states-example.hbs';
import ButtonBlockTemplateRaw from '!raw!./button-block-example.hbs';
import ButtonTypesTemplateRaw from '!raw!./button-types-example.hbs';
import ButtonLinkExampleRaw from '!raw!./button-link-example.hbs';
import ButtonTypesTemplate from './button-types-example.hbs';
import ButtonVariationTemplate from './button-variations-example.hbs';
import ButtonStatesTemplate from './button-states-example.hbs';
import ButtonBlockTemplate from './button-block-example.hbs';
import ButtonTypesTemplate from './button-types-example.hbs';
import ButtonLinkExample from './button-link-example.hbs';
import docs from '../docs/code.md';

export const Docs = docs;

export default (props) => {
const buttonTypesTemplate = ButtonTypesTemplate();
export default props => {
const buttonVariationTemplate = ButtonVariationTemplate();
const buttonStatesTemplate = ButtonStatesTemplate();
const buttonLinkExample = ButtonLinkExample();
const buttonBlockTemplate = ButtonBlockTemplate();
const buttonTypesTemplate = ButtonTypesTemplate();
const headingText = 'Button';
const variablesRoot = 'pf-c-button';

return (
<Documentation data={props} docs={Docs} heading={headingText} variablesRoot={variablesRoot}>
<Example heading="Button types" handlebars={ButtonTypesTemplateRaw}>
{buttonTypesTemplate}
<Example heading="Button variations" handlebars={ButtonVariationTemplateRaw}>
{buttonVariationTemplate}
</Example>
<Example heading="Button states" handlebars={ButtonStatesTemplateRaw}>
{buttonStatesTemplate}
Expand All @@ -35,6 +38,9 @@ export default (props) => {
<Example heading="Button (block level)" handlebars={ButtonBlockTemplateRaw}>
{buttonBlockTemplate}
</Example>
<Example heading="Button types" handlebars={ButtonTypesTemplateRaw}>
{buttonTypesTemplate}
</Example>
</Documentation>
);
};
2 changes: 1 addition & 1 deletion src/patternfly/components/Expandable/expandable-toggle.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<button class="pf-c-expandable__toggle{{#if expandable-toggle--modifier}} {{expandable-toggle--modifier}}{{/if}}"
<button type="button" class="pf-c-expandable__toggle{{#if expandable-toggle--modifier}} {{expandable-toggle--modifier}}{{/if}}"
{{#if expandable-toggle--attribute}}
{{{expandable-toggle--attribute}}}
{{/if}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{#> form}}
{{#> form-group form-group--modifier="pf-m-action"}}
{{#> form-actions}}
{{#> button button--modifier="pf-m-primary"}}
{{#> button button--modifier="pf-m-primary" button--IsSubmit="true"}}
Submit form
{{/button}}
{{#> button button--modifier="pf-m-secondary"}}
Cancel
{{#> button button--modifier="pf-m-secondary" button--IsReset="true"}}
Reset form
{{/button}}
{{/form-actions}}
{{/form-group}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{{/check}}
{{/form-group}}
{{#> form-group form-group--modifier="pf-m-action"}}
{{#> button button--modifier="pf-m-primary pf-m-block" button--attribute='type="submit"'}}
{{#> button button--modifier="pf-m-primary pf-m-block" button--IsSubmit="true"}}
Log in
{{/button}}
{{/form-group}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{{/check}}
{{/form-group}}
{{#> form-group form-group--modifier="pf-m-action"}}
{{#> button button--modifier="pf-m-primary pf-m-block" button--attribute='type="submit"'}}
{{#> button button--modifier="pf-m-primary pf-m-block" button--IsSubmit="true"}}
Log in
{{/button}}
{{/form-group}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
{{/wizard-main}}
{{/wizard-inner-wrap}}
{{#> wizard-footer}}
{{#> button button--modifier="pf-m-primary" button--attribute='type="submit"'}}
{{#> button button--modifier="pf-m-primary" button--IsSubmit="true"}}
Next
{{/button}}
{{#> button button--modifier="pf-m-secondary"}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
{{/wizard-main}}
{{/wizard-inner-wrap}}
{{#> wizard-footer}}
{{#> button button--modifier="pf-m-primary" button--attribute='type="submit"'}}
{{#> button button--modifier="pf-m-primary" button--IsSubmit="true"}}
Next
{{/button}}
{{#> button button--modifier="pf-m-secondary"}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
{{/wizard-main}}
{{/wizard-inner-wrap}}
{{#> wizard-footer}}
{{#> button button--modifier="pf-m-primary" button--attribute='type="submit"'}}
{{#> button button--modifier="pf-m-primary" button--IsSubmit="true"}}
Next
{{/button}}
{{#> button button--modifier="pf-m-secondary"}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
{{/wizard-main}}
{{/wizard-inner-wrap}}
{{#> wizard-footer}}
{{#> button button--modifier="pf-m-primary" button--attribute='type="submit"'}}
{{#> button button--modifier="pf-m-primary" button--IsSubmit="true"}}
Next
{{/button}}
{{#> button button--modifier="pf-m-secondary"}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
{{/wizard-main}}
{{/wizard-inner-wrap}}
{{#> wizard-footer}}
{{#> button button--modifier="pf-m-primary" button--attribute='type="submit"'}}
{{#> button button--modifier="pf-m-primary" button--IsSubmit="true"}}
Next
{{/button}}
{{#> button button--modifier="pf-m-secondary"}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
{{#> form-group form-group--modifier="pf-m-action"}}
{{#> horizontal-form-group }}
{{#> form-actions}}
{{#> button button--modifier="pf-m-primary"}}
{{#> button button--modifier="pf-m-primary" button--IsSubmit="true"}}
Submit form
{{/button}}
{{#> button button--modifier="pf-m-secondary"}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
{{/form-group}}
{{#> form-group form-group--modifier="pf-m-action"}}
{{#> form-actions}}
{{#> button button--modifier="pf-m-primary"}}
{{#> button button--modifier="pf-m-primary" button--IsSubmit="true"}}
Submit form
{{/button}}
{{#> button button--modifier="pf-m-secondary"}}
Expand Down

0 comments on commit b0732f6

Please sign in to comment.