Skip to content

Commit

Permalink
Use BlockIcon component where icon prop can be an object
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyhun committed Jul 23, 2021
1 parent 9ecad94 commit 3bb454c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
7 changes: 2 additions & 5 deletions packages/block-library/src/embed/embed-no-preview.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { useSelect } from '@wordpress/data';
import { store as editorStore } from '@wordpress/editor';
import { BottomSheet, Icon, TextControl } from '@wordpress/components';
import { help } from '@wordpress/icons';
import { BlockIcon } from '@wordpress/block-editor';

/**
* Internal dependencies
Expand All @@ -38,10 +39,6 @@ const EmbedNoPreview = ( { label, icon, isSelected, onPress } ) => {
styles.embed__label,
styles[ 'embed__label--dark' ]
);
const embedIconStyle = usePreferredColorSchemeStyle(
styles.embed__icon,
styles[ 'embed__icon--dark' ]
);
const descriptionStyle = usePreferredColorSchemeStyle(
styles.embed__description,
styles[ 'embed__description--dark' ]
Expand Down Expand Up @@ -118,7 +115,7 @@ const EmbedNoPreview = ( { label, icon, isSelected, onPress } ) => {
onPress={ onPressContainer }
>
<View style={ containerStyle }>
<Icon icon={ icon } fill={ embedIconStyle.fill } />
<BlockIcon icon={ icon } />
<Text style={ labelStyle }>{ label }</Text>
<Text style={ descriptionStyle }>
{ __( 'Embed previews not yet available' ) }
Expand Down
7 changes: 2 additions & 5 deletions packages/block-library/src/embed/embed-placeholder.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { View, Text, TouchableWithoutFeedback } from 'react-native';
import { __ } from '@wordpress/i18n';
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
import { Icon } from '@wordpress/components';
import { BlockIcon } from '@wordpress/block-editor';

/**
* Internal dependencies
Expand Down Expand Up @@ -37,10 +38,6 @@ const EmbedPlaceholder = ( {
styles.embed__action,
styles[ 'embed__action--dark' ]
);
const embedIconStyle = usePreferredColorSchemeStyle(
styles.embed__icon,
styles[ 'embed__icon--dark' ]
);
const embedIconErrorStyle = styles[ 'embed__icon--error' ];

return (
Expand Down Expand Up @@ -73,7 +70,7 @@ const EmbedPlaceholder = ( {
</>
) : (
<>
<Icon icon={ icon } fill={ embedIconStyle.fill } />
<BlockIcon icon={ icon } />
<Text style={ labelStyle }>{ label }</Text>
<Text style={ actionStyle }>
{ __( 'ADD LINK' ) }
Expand Down
8 changes: 0 additions & 8 deletions packages/block-library/src/embed/styles.native.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@
background-color: $background-dark-secondary;
}

.embed__icon {
fill: $light-secondary;
}

.embed__icon--dark {
fill: $dark-secondary;
}

.embed__icon--error {
margin-bottom: 6;
fill: $alert-red;
Expand Down

0 comments on commit 3bb454c

Please sign in to comment.