Skip to content

Commit

Permalink
Boost: Migrate Tips to react (#34697)
Browse files Browse the repository at this point in the history
* Update Tips to react

* add changelog
  • Loading branch information
dilirity authored Dec 19, 2023
1 parent 8c9a66a commit c0d2196
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 55 deletions.
1 change: 0 additions & 1 deletion projects/plugins/boost/app/assets/src/css/admin-style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// Components
@import 'components/connection';
@import 'components/feature-toggle';
@import 'components/benchmarks';
@import 'components/error-message';
@import 'components/critical-css';
@import 'components/close-button';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import SpeedScore from '../../features/speed-score/speed-score';
import Support from './support/support';
import Tips from './Tips.svelte';
import Tips from './tips/tips';
import ReactComponent from '$features/ReactComponent.svelte';
import Footer from '$layout/footer/footer';
import Header from '$layout/header/header';
Expand Down Expand Up @@ -30,7 +30,7 @@
<slot />
</div>

<Tips />
<ReactComponent this={Tips} />

{#if $hasPrioritySupport}
<ReactComponent this={Support} />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
.jb-dashboard .jb-tips {
@import '../../../../css/main/variables.scss';
@import '../../../../css/main/mixins.scss';

.tips {
margin: 0 auto;

&__title {
.tips-title {
margin-bottom: $padding;
}

&__items {
.tips-items {
@include breakpoint(md) {
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 2em; }
grid-gap: 2em;
}
}

.item {
@include breakpoint(sm) {
display: grid;
grid-template-columns: 80px 1fr;
grid-gap: 1em;

}

margin-bottom: 2em;


&__rate {
.item-rate {
font-size: 24px;
font-weight: 400;
line-height: 30px;
Expand All @@ -36,7 +39,7 @@
}
}

&__description {
.item-description {
flex-basis: 70%;
font-weight: 400;
line-height: 24px;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { getRedirectUrl } from '@automattic/jetpack-components';
import { createInterpolateElement } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import styles from './tips.module.scss';

const Tips = () => {
const pingdomLink = getRedirectUrl( 'jetpack-boost-pingdom' );
const whySpeedLink = getRedirectUrl( 'jetpack-boost-why-speed' );

return (
<div className="jb-section jb-section--alt">
<div className="jb-container--narrow">
<div className={ styles.tips }>
<h3 className={ styles[ 'tips-title' ] }>{ __( 'Did you know?', 'jetpack-boost' ) }</h3>
<div className={ styles[ 'tips-items' ] }>
<div className={ styles.item }>
<div className={ styles[ 'item-rate' ] }>4x</div>
<div className={ styles[ 'item-description' ] }>
{ createInterpolateElement(
__(
`Pages that take over 3 seconds to load have 4x the bounce rate of pages that load in 2 seconds or less. (source: <link>Pingdom</link>).`,
'jetpack-boost'
),
{
// eslint-disable-next-line jsx-a11y/anchor-has-content
link: <a href={ pingdomLink } target="_blank" rel="noopener noreferrer" />,
}
) }
</div>
</div>
<div className={ styles.item }>
<div className={ styles[ 'item-rate' ] }>20%</div>
<div className={ styles[ 'item-description' ] }>
{ createInterpolateElement(
__(
`A one-second delay in loading times can reduce conversion rates by 20%. (source: <link>Google</link>).`,
'jetpack-boost'
),
{
// eslint-disable-next-line jsx-a11y/anchor-has-content
link: <a href={ whySpeedLink } target="_blank" rel="noopener noreferrer" />,
}
) }
</div>
</div>
</div>
</div>
</div>
</div>
);
};

export default Tips;
5 changes: 5 additions & 0 deletions projects/plugins/boost/changelog/migrate-settings-page-tips
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Migrate Settings Page Tips to react.


0 comments on commit c0d2196

Please sign in to comment.