Skip to content

Commit

Permalink
feat: update debug mode notice style and position (#1605)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasguillot authored Apr 14, 2022
1 parent 3106f18 commit b28075c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 32 deletions.
4 changes: 4 additions & 0 deletions assets/components/src/notice/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
import { Component, RawHTML } from '@wordpress/element';
import { Icon, check, help, info } from '@wordpress/icons';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies.
Expand All @@ -25,6 +26,7 @@ class Notice extends Component {
render() {
const {
className,
debugMode,
isError,
isHelp,
isSuccess,
Expand All @@ -37,6 +39,7 @@ class Notice extends Component {
const classes = classnames(
'newspack-notice',
className,
debugMode && 'newspack-notice__is-debug',
isError && 'newspack-notice__is-error',
isHelp && 'newspack-notice__is-help',
isSuccess && 'newspack-notice__is-success',
Expand All @@ -55,6 +58,7 @@ class Notice extends Component {
{ <Icon icon={ noticeIcon } /> }
<div className="newspack-notice__content">
{ rawHTML ? <RawHTML>{ noticeText }</RawHTML> : noticeText }
{ debugMode && __( 'Debug Mode', 'newspack' ) }
{ children || null }
</div>
</div>
Expand Down
16 changes: 16 additions & 0 deletions assets/components/src/notice/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@
margin-right: 4px;
}

&__is-debug {
background: $primary-700;
bottom: 16px;
box-shadow: 0 0 8px 4px rgba( black, 0.08 );
color: white;
font-weight: bold;
margin: 0 16px;
position: fixed;
text-transform: uppercase;
z-index: 9997;

> svg {
fill: white;
}
}

&__is-error {
background: lighten( $alert-red, 51% );

Expand Down
8 changes: 1 addition & 7 deletions assets/components/src/with-wizard-screen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,7 @@ export default function withWizardScreen( WrappedComponent, { hidePrimaryButton
);
return (
<>
{ newspack_aux_data.is_debug_mode && (
<Notice
isWarning
className="newspack-wizard__above-header"
noticeText={ __( 'Newspack is in debug mode.', 'newspack' ) }
/>
) }
{ newspack_aux_data.is_debug_mode && <Notice debugMode /> }
<div className="newspack-wizard__header">
<div className="newspack-wizard__header__inner">
<div className="newspack-wizard__title">
Expand Down
8 changes: 1 addition & 7 deletions assets/components/src/wizard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,7 @@ const Wizard = ( {
) }
>
<HashRouter hashType="slash">
{ newspack_aux_data.is_debug_mode && (
<Notice
isWarning
className="newspack-wizard__above-header"
noticeText={ __( 'Newspack is in debug mode.', 'newspack' ) }
/>
) }
{ newspack_aux_data.is_debug_mode && <Notice debugMode /> }
<div className="bg-white">
<div className="newspack-wizard__header__inner">
<div className="newspack-wizard__title">
Expand Down
8 changes: 1 addition & 7 deletions assets/wizards/componentsDemo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,7 @@ class ComponentsDemo extends Component {

return (
<Fragment>
{ newspack_aux_data.is_debug_mode && (
<Notice
isWarning
className="newspack-wizard__above-header"
noticeText={ __( 'Newspack is in debug mode.', 'newspack' ) }
/>
) }
{ newspack_aux_data.is_debug_mode && <Notice debugMode /> }
<div className="newspack-wizard__header">
<div className="newspack-wizard__header__inner">
<div className="newspack-wizard__title">
Expand Down
8 changes: 1 addition & 7 deletions assets/wizards/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@ const Dashboard = ( { items } ) => {
return (
<Fragment>
<GlobalNotices />
{ newspack_aux_data.is_debug_mode && (
<Notice
isWarning
className="newspack-wizard__above-header"
noticeText={ __( 'Newspack is in debug mode.', 'newspack' ) }
/>
) }
{ newspack_aux_data.is_debug_mode && <Notice debugMode /> }
<div className="newspack-wizard__header">
<div className="newspack-wizard__header__inner">
<div className="newspack-wizard__title">
Expand Down
4 changes: 0 additions & 4 deletions assets/wizards/dashboard/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,3 @@
fill: $primary-500;
}
}

.newspack-notice {
margin: 0;
}

0 comments on commit b28075c

Please sign in to comment.