-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #733 from WordPress/add/placeholder-component
Add Placeholder component
- Loading branch information
Showing
5 changed files
with
83 additions
and
64 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
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,29 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import classnames from 'classnames'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import './style.scss'; | ||
import Dashicon from 'components/dashicon'; | ||
|
||
function Placeholder( { icon, children, label, instructions, className, ...additionalProps } ) { | ||
const classes = classnames( 'components-placeholder', className ); | ||
|
||
return ( | ||
<div { ...additionalProps } aria-label={ label } className={ classes }> | ||
<div className="components-placeholder__label"> | ||
<Dashicon icon={ icon } /> | ||
{ label } | ||
</div> | ||
{ !! instructions && <div className="components-placeholder__instructions">{ instructions }</div> } | ||
<div className="components-placeholder__fieldset"> | ||
{ children } | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default Placeholder; |
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,40 @@ | ||
.components-placeholder { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
padding: 1em; | ||
min-height: 200px; | ||
text-align: center; | ||
font-family: $default-font; | ||
font-size: $default-font-size; | ||
background: $light-gray-100; | ||
} | ||
|
||
.components-placeholder__label { | ||
display: flex; | ||
justify-content: center; | ||
font-weight: bold; | ||
margin-bottom: 1em; | ||
|
||
.dashicon { | ||
margin-right: 1ch; | ||
} | ||
} | ||
|
||
.components-placeholder__fieldset { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: center; | ||
width: 100%; | ||
max-width: 280px; | ||
} | ||
|
||
.components-placeholder__input { | ||
margin-right: 8px; | ||
flex: 1 1 auto; | ||
} | ||
|
||
.components-placeholder__instructions { | ||
margin-bottom: 1em; | ||
} |