-
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.
UrlInput: Reorganize Folder Structure, moving the url-input up in the…
… hierarchy
- Loading branch information
1 parent
cceec42
commit b749af4
Showing
10 changed files
with
305 additions
and
304 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 was deleted.
Oops, something went wrong.
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,75 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import classnames from 'classnames'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import './style.scss'; | ||
import { __ } from 'i18n'; | ||
import { Component } from 'element'; | ||
import { IconButton } from 'components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import UrlInput from './'; | ||
|
||
class UrlInputButton extends Component { | ||
constructor() { | ||
super( ...arguments ); | ||
this.toggle = this.toggle.bind( this ); | ||
this.submitLink = this.submitLink.bind( this ); | ||
this.state = { | ||
expanded: false, | ||
}; | ||
} | ||
|
||
toggle() { | ||
this.setState( { expanded: ! this.state.expanded } ); | ||
} | ||
|
||
submitLink( event ) { | ||
event.preventDefault(); | ||
this.toggle(); | ||
} | ||
|
||
render() { | ||
const { url, onChange } = this.props; | ||
const { expanded } = this.state; | ||
|
||
return ( | ||
<li className="blocks-url-input__button"> | ||
<IconButton | ||
icon="admin-links" | ||
label={ __( 'Edit Image Link' ) } | ||
onClick={ this.toggle } | ||
className={ classnames( 'components-toolbar__control', { | ||
'is-active': url, | ||
} ) } | ||
/> | ||
{ expanded && | ||
<form | ||
className="blocks-format-toolbar__link-modal" | ||
onSubmit={ this.submitLink }> | ||
<IconButton | ||
className="blocks-url-input__back" | ||
icon="arrow-left-alt" | ||
label={ __( 'Close' ) } | ||
onClick={ this.toggle } | ||
/> | ||
<UrlInput value={ url || '' } onChange={ onChange } /> | ||
<IconButton | ||
icon="editor-break" | ||
label={ __( 'Submit' ) } | ||
type="submit" | ||
/> | ||
</form> | ||
} | ||
</li> | ||
); | ||
} | ||
} | ||
|
||
export default UrlInputButton; |
Oops, something went wrong.