From a873a541fbfa31f0111566eb86237be9e2c8f335 Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Fri, 9 Feb 2024 17:50:37 +0530 Subject: [PATCH] some pro improvements --- src/components/MainHeader.jsx | 6 ++++- src/components/ProBadge.jsx | 3 +++ src/components/Profile.jsx | 37 +++++++++++++++++--------- src/components/Stack.jsx | 49 +++++++++++++++++++++++++++++++++-- src/style.css | 11 ++++++++ 5 files changed, 91 insertions(+), 15 deletions(-) create mode 100644 src/components/ProBadge.jsx diff --git a/src/components/MainHeader.jsx b/src/components/MainHeader.jsx index 007714b..108ed3c 100644 --- a/src/components/MainHeader.jsx +++ b/src/components/MainHeader.jsx @@ -2,6 +2,8 @@ import { h } from 'preact'; import { Button } from './common'; import { Trans, NumberFormat, t } from '@lingui/macro'; import { I18n } from '@lingui/react'; +import { ProBadge } from './ProBadge'; +import { Stack } from './Stack'; const DEFAULT_PROFILE_IMG = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ccc' d='M12,19.2C9.5,19.2 7.29,17.92 6,16C6.03,14 10,12.9 12,12.9C14,12.9 17.97,14 18,16C16.71,17.92 14.5,19.2 12,19.2M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z'/%3E%3C/svg%3E"; @@ -46,7 +48,9 @@ export function MainHeader(props) { class="btn btn--dark hint--rounded hint--bottom-left" aria-label={i18n._(t`Upload/Use assets`)} > - Assets{' '} + + Assets + {!props.isFileMode && ( diff --git a/src/components/ProBadge.jsx b/src/components/ProBadge.jsx new file mode 100644 index 0000000..92575f2 --- /dev/null +++ b/src/components/ProBadge.jsx @@ -0,0 +1,3 @@ +export const ProBadge = () => { + return
PRO
; +}; diff --git a/src/components/Profile.jsx b/src/components/Profile.jsx index 738418a..7a1050b 100644 --- a/src/components/Profile.jsx +++ b/src/components/Profile.jsx @@ -1,4 +1,6 @@ import { h } from 'preact'; +import { ProBadge } from './ProBadge'; +import { HStack, Stack, VStack } from './Stack'; const DEFAULT_PROFILE_IMG = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ccc' d='M12,19.2C9.5,19.2 7.29,17.92 6,16C6.03,14 10,12.9 12,12.9C14,12.9 17.97,14 18,16C16.71,17.92 14.5,19.2 12,19.2M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z'/%3E%3C/svg%3E"; @@ -13,18 +15,29 @@ export function Profile({ user, logoutBtnHandler }) { id="profileAvatarImg" alt="Profile image" /> -

- {user && user.displayName ? user.displayName : 'Anonymous Creator'} -

-

- -

+ + + +

+ {user && user.displayName ? user.displayName : 'Anonymous Creator'} +

+ {user.isPro && ( + + + + )} +
+ + + + +
); } diff --git a/src/components/Stack.jsx b/src/components/Stack.jsx index c5036d7..e093270 100644 --- a/src/components/Stack.jsx +++ b/src/components/Stack.jsx @@ -1,9 +1,54 @@ const gaps = [0, '0.5rem', '1rem', '1.5rem', '3rem', '5rem']; -export const Stack = ({ gap = 0, children }) => { +const Stack = function ({ + classes = '', + gap = 0, + align = 'center', + justify = 'flex-start', + direction = 'horizontal', + fullWidth = false, + fullHeight = false, + wrap, + children +}) { return ( -
+
{children}
); }; + +const VStack = props => { + return ; +}; + +const HStack = props => { + return ( + + ); +}; + +const Spacer = () => { + return ( + <> +
+ + ); +}; + +export { Stack, VStack, HStack, Spacer }; diff --git a/src/style.css b/src/style.css index f877e95..7c63780 100644 --- a/src/style.css +++ b/src/style.css @@ -2112,11 +2112,22 @@ while the theme CSS file is loading */ } .stack { display: flex; + align-items: center; } .stack > * { margin: 0; } +.pro-badge { + padding: 0.1rem 0.3rem; + background-color: #fff91f; + border-radius: 1rem; + font-size: 0.8em; + color: #222; + box-shadow: inset 2px 2px 3px rgba(0, 0, 0, 0.3); + font-weight: 700; + line-height: 1; +} @media screen and (max-width: 600px) { body { font-size: 70%;