diff --git a/packages/block-editor/src/components/block-list/index.native.js b/packages/block-editor/src/components/block-list/index.native.js index 810e23e4c1442..4c4d7914b1806 100644 --- a/packages/block-editor/src/components/block-list/index.native.js +++ b/packages/block-editor/src/components/block-list/index.native.js @@ -30,6 +30,7 @@ import { import { BlockDraggableWrapper } from '../block-draggable'; import { useEditorWrapperStyles } from '../../hooks/use-editor-wrapper-styles'; import { store as blockEditorStore } from '../../store'; +import OfflineStatus from '../offline-status'; const identity = ( x ) => x; @@ -235,6 +236,10 @@ export default function BlockList( { onLayout={ onLayout } testID="block-list-wrapper" > + { + // eslint-disable-next-line no-undef + __DEV__ && + } { isRootList ? ( { + const { isConnected } = useIsConnected(); + + const containerStyle = usePreferredColorSchemeStyle( + styles.offline, + styles.offline__dark + ); + + const textStyle = usePreferredColorSchemeStyle( + styles[ 'offline--text' ], + styles[ 'offline--text__dark' ] + ); + + const iconStyle = usePreferredColorSchemeStyle( + styles[ 'offline--icon' ], + styles[ 'offline--icon__dark' ] + ); + + return ! isConnected ? ( + + + { __( 'Working Offline' ) } + + ) : null; +}; + +export default OfflineStatus; diff --git a/packages/block-editor/src/components/offline-status/style.native.scss b/packages/block-editor/src/components/offline-status/style.native.scss new file mode 100644 index 0000000000000..529693516653f --- /dev/null +++ b/packages/block-editor/src/components/offline-status/style.native.scss @@ -0,0 +1,28 @@ +.offline { + background-color: $gray-lighten-30; + padding: $grid-unit; + justify-content: center; + align-items: center; + flex-direction: row; +} + +.offline__dark { + background-color: $gray-70; +} + +.offline--text { + color: $black; + padding-left: 3; +} + +.offline--text__dark { + color: $white; +} + +.offline--icon { + fill: $gray-70; +} + +.offline--icon__dark { + fill: $gray-10; +} diff --git a/packages/icons/src/index.js b/packages/icons/src/index.js index 36b2971423442..d743299d35a24 100644 --- a/packages/icons/src/index.js +++ b/packages/icons/src/index.js @@ -190,6 +190,7 @@ export { default as postList } from './library/post-list'; export { default as postTerms } from './library/post-terms'; export { default as previous } from './library/previous'; export { default as next } from './library/next'; +export { default as offline } from './library/offline'; export { default as preformatted } from './library/preformatted'; export { default as pullLeft } from './library/pull-left'; export { default as pullRight } from './library/pull-right'; diff --git a/packages/icons/src/library/offline.js b/packages/icons/src/library/offline.js new file mode 100644 index 0000000000000..f0daa1aaeb79e --- /dev/null +++ b/packages/icons/src/library/offline.js @@ -0,0 +1,22 @@ +/** + * WordPress dependencies + */ +import { SVG, Path } from '@wordpress/primitives'; + +const offline = ( + + + +); + +export default offline; diff --git a/test/native/setup.js b/test/native/setup.js index 3770a4ce3efc6..0f4c9f9eda20c 100644 --- a/test/native/setup.js +++ b/test/native/setup.js @@ -107,6 +107,7 @@ jest.mock( '@wordpress/react-native-bridge', () => { subscribeShowEditorHelp: jest.fn(), subscribeOnUndoPressed: jest.fn(), subscribeOnRedoPressed: jest.fn(), + useIsConnected: jest.fn( () => ( { isConnected: true } ) ), editorDidMount: jest.fn(), editorDidAutosave: jest.fn(), subscribeMediaUpload: jest.fn(),