0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

Updated discount in account home page

This commit is contained in:
Peter Zimon 2022-01-05 15:03:53 +01:00
parent 86a8abdf30
commit 1a25cac7ad
4 changed files with 33 additions and 14 deletions

View file

@ -18,8 +18,8 @@ const React = require('react');
const DEV_MODE_DATA = {
showPopup: true,
site: Fixtures.site,
member: Fixtures.member.free,
page: 'offer',
member: Fixtures.member.paid,
page: 'accountHome',
pageData: Fixtures.offer
};

View file

@ -250,7 +250,7 @@ const FrameStyles = `
letter-spacing: 0;
text-rendering: optimizeLegibility;
background: var(--white);
width: 400px;
width: 440px;
margin: 0 auto;
border-radius: 5px;
box-shadow: 0 3.8px 2.2px rgba(0, 0, 0, 0.028), 0 9.2px 5.3px rgba(0, 0, 0, 0.04), 0 17.3px 10px rgba(0, 0, 0, 0.05), 0 30.8px 17.9px rgba(0, 0, 0, 0.06), 0 57.7px 33.4px rgba(0, 0, 0, 0.072), 0 138px 80px rgba(0, 0, 0, 0.1);
@ -472,7 +472,7 @@ const FrameStyles = `
letter-spacing: 0.3px;
line-height: 1.25em;
padding: 0;
margin: 2px 0 0;
margin: 4px 0 0;
color: var(--grey6);
}

View file

@ -99,6 +99,25 @@ export const AccountHomePageStyles = `
margin-right: 12px;
border-radius: 2px;
}
.gh-portal-account-discountcontainer {
position: relative;
display: flex;
align-items: center;
}
.gh-portal-account-old-price {
text-decoration: line-through;
color: var(--grey9) !important;
}
.gh-portal-account-tagicon {
width: 16px;
height: 16px;
color: var(--brandcolor);
margin-right: 5px;
z-index: 999;
}
`;
const UserAvatar = ({avatar, brandColor}) => {
@ -152,7 +171,7 @@ function getOfferLabel({offer, price, subscriptionStartDate}) {
let offerEndDate = new Date(offerStartDate.setMonth(offerStartDate.getMonth() + durationInMonths));
durationLabel = `Ends ${getDateString(offerEndDate)}`;
}
offerLabel = `${getUpdatedOfferPrice({offer, price, useFormatted: true})}/${price.interval} - ${durationLabel}`;
offerLabel = `${getUpdatedOfferPrice({offer, price, useFormatted: true})}/${price.interval}${durationLabel ? ` ${durationLabel}` : ``}`;
}
return offerLabel;
}
@ -191,14 +210,14 @@ const PaidAccountActions = () => {
}
let oldPriceClassName = '';
if (offerLabelStr) {
oldPriceClassName = 'old-price';
oldPriceClassName = 'gh-portal-account-old-price';
}
const OfferLabel = () => {
if (offerLabelStr) {
return (
<p>
<OfferTagIcon style={{width: '12px', height: '9px', marginLeft: '-10px'}}/>
{offerLabelStr}
<p className="gh-portal-account-discountcontainer">
<OfferTagIcon className="gh-portal-account-tagicon" />
<span>{offerLabelStr}</span>
</p>
);
}

View file

@ -53,7 +53,7 @@ function getOfferData({
type = 'percent',
cadence = 'month',
amount = 50,
duration = 'once',
duration = 'repeating',
durationInMonths = null,
currencyRestriction = false,
currency = null,
@ -86,7 +86,7 @@ function getMemberData({
email = 'jamie@example.com',
firstname = 'Jamie',
subscriptions = [],
paid = false,
paid = true,
avatarImage: avatar_image = '',
subscribed = true
} = {}) {
@ -131,7 +131,7 @@ export function getProductsData({numOfProducts = 3} = {}) {
numOfBenefits: 3
}),
getProductData({
name: 'Friends of the browser',
name: 'Friends of the Blueprint',
description: 'Get access to everything and lock in early adopter pricing for life + listen to my podcast',
monthlyPrice: getPriceData({
interval: 'month',
@ -162,7 +162,6 @@ function getProductData({
monthlyPrice,
yearlyPrice,
benefits: getBenefits({numOfBenefits})
};
}
@ -213,7 +212,7 @@ function getSubscriptionData({
id = `sub_${objectId()}`,
status = 'active',
currency = 'USD',
interval = 'month',
interval = 'year',
amount = (interval === 'month' ? 500 : 5000),
nickname = (interval === 'month' ? 'Monthly' : 'Yearly'),
cardLast4 = '4242',
@ -236,6 +235,7 @@ function getSubscriptionData({
interval,
currency
},
offer,
status,
start_date,
default_payment_card_last4: cardLast4,