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

Social Links: Use URLInput #18905

Merged
merged 3 commits into from
Dec 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/contributors/coding-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function Notice( { children, onRemove, isDismissible } ) {
}
```

A component's class name should **never** be used outside its own folder (with rare exceptions such as [`_z-index.scss`](https://github.com/WordPress/gutenberg/blob/master/packages/base-styles/_z-index.scss)). If you need to inherit styles of another component in your own components, you should render an instance of that other component. At worst, you should duplicate the styles within your own component's stylesheet. This is intended to improve maintainability by treating individual components as the isolated abstract interface.
A component's class name should **never** be used outside its own folder (with rare exceptions such as [`_z-index.scss`](https://github.com/WordPress/gutenberg/blob/master/packages/base-styles/_z-index.scss)). If you need to inherit styles of another component in your own components, you should render an instance of that other component. At worst, you should duplicate the styles within your own component's stylesheet. This is intended to improve maintainability by isolating shared components as a reusable interface, reducing the surface area of similar UI elements by adapting a limited set of common components to support a varied set of use-cases.

#### SCSS File Naming Conventions for Blocks

Expand Down
14 changes: 6 additions & 8 deletions packages/block-library/src/social-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import classNames from 'classnames';
/**
* WordPress dependencies
*/
import { URLPopover } from '@wordpress/block-editor';
import { URLPopover, URLInput } from '@wordpress/block-editor';
import { useState } from '@wordpress/element';
import {
Button,
Expand Down Expand Up @@ -47,13 +47,11 @@ const SocialLinkEdit = ( { attributes, setAttributes, isSelected } ) => {
event.preventDefault();
setPopover( false );
} } >
<div className="editor-url-input block-editor-url-input">
<input type="text"
value={ url }
onChange={ ( event ) => setAttributes( { url: event.target.value } ) }
placeholder={ __( 'Enter Address' ) }
/>
</div>
<URLInput
value={ url }
onChange={ ( nextURL ) => setAttributes( { url: nextURL } ) }
placeholder={ __( 'Enter Address' ) }
/>
<IconButton icon="editor-break" label={ __( 'Apply' ) } type="submit" />
</form>
</URLPopover>
Expand Down