1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-08-01 19:10:22 +02:00

imporve share styling

This commit is contained in:
Kushagra Gour
2024-04-29 14:31:59 +05:30
parent 326e138654
commit 2557c40c33
3 changed files with 69 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
import { useEffect, useState } from 'preact/hooks';
import { ProBadge } from './ProBadge';
import { Skeleton } from './Skeleton';
import { HStack, Stack, VStack } from './Stack';
import Switch from './Switch';
import { itemService } from '../itemService';
@@ -114,9 +114,25 @@ export function Share({
{!user?.isPro ? (
<VStack gap={1} align="stretch">
<p>
Public creations available: {FREE_PUBLIC_ITEM_COUNT}. Used:{' '}
{publicItemCount === undefined ? '-' : publicItemCount}. Left:{' '}
{Math.max(0, FREE_PUBLIC_ITEM_COUNT - publicItemCount)}
<HStack gap={3} justify="flex-start">
<span>Public creations available: {FREE_PUBLIC_ITEM_COUNT}</span>
<span>
Used:{' '}
{publicItemCount === undefined ? (
<Skeleton width="2ch" />
) : (
publicItemCount
)}
</span>
<span>
Left:{' '}
{publicItemCount === undefined ? (
<Skeleton width="2ch" />
) : (
Math.max(0, FREE_PUBLIC_ITEM_COUNT - publicItemCount)
)}
</span>
</HStack>
</p>
<p>
<HStack gap={1}>

View File

@@ -0,0 +1,3 @@
export const Skeleton = ({ width }) => {
return <div className="skeleton" style={{ width }}></div>;
};

View File

@@ -2369,6 +2369,52 @@ while the theme CSS file is loading */
inset 0px 1px 3px rgba(255, 255, 255, 0.1);
}
.skeleton {
display: inline-block;
height: 0.5em;
background-color: currentColor;
border-radius: 999px;
animation: 2s linear infinite skeleton;
transform-origin: left;
}
@keyframes skeleton {
20% {
transform-origin: left;
opacity: 1;
transform: scaleX(1.5);
opacity: 0.5;
}
20.1% {
transform-origin: right;
transform: scaleX(1.5) translateX(33%);
}
50% {
transform-origin: right;
transform: scaleX(1) translateX(50%);
opacity: 1;
}
70% {
transform-origin: right;
transform: scaleX(1.5) translateX(33%);
}
70.1% {
transform-origin: left;
transform: scaleX(1.5);
}
90% {
transform-origin: left;
transform: scaleX(1);
opacity: 0.5;
}
/* 100% {
transform-origin: right;
transform: scaleX(1.5) translateX(33%);
opacity: 1;
} */
}
@media screen and (max-width: 600px) {
body {
font-size: 70%;