-
Notifications
You must be signed in to change notification settings - Fork 843
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EuiButton, EuiButtonEmpty and EuiButtonIcon can now take an HREF (#316)
Buttons now switch to anchor tags if an href is present.
- Loading branch information
Showing
8 changed files
with
158 additions
and
35 deletions.
There are no files selected for viewing
This file contains 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 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,28 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
EuiButton, | ||
EuiButtonEmpty, | ||
EuiButtonIcon, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
} from '../../../../src/components'; | ||
|
||
export default () => ( | ||
<EuiFlexGroup gutterSize="s" alignItems="center"> | ||
<EuiFlexItem grow={false}> | ||
<EuiButton href="http://www.elastic.co"> | ||
Link to elastic.co | ||
</EuiButton> | ||
</EuiFlexItem> | ||
|
||
<EuiFlexItem grow={false}> | ||
<EuiButtonEmpty href="http://www.elastic.co"> | ||
Link to elastic.co | ||
</EuiButtonEmpty> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiButtonIcon href="http://www.elastic.co" iconType="link" aria-label="This is a link" /> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
); |
This file contains 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 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 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 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 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 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,8 @@ | ||
export default function checkHrefAndOnClick(props, propName, componentName) { | ||
if (props.href && props.onClick) { | ||
throw new Error( | ||
`${componentName} must either specify an href property (if it should be a link) ` + | ||
`or an onClick property (if it should be a button), but not both.` | ||
); | ||
} | ||
} |