Skip to content

Commit

Permalink
docs(core): remember card flips (#21041)
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacplmann authored Jan 8, 2024
1 parent 2ee326c commit 530711d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions nx-dev/ui-common/src/lib/flip-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,11 @@ export function FlipCard({
onClick?: () => void;
children: ReactNode;
}) {
const [flipped, setFlipped] = useState(() => isFlipped);

return (
<FlipCardContext.Provider value={{ fullDate: fullDate || '', onClick }}>
<span
onClick={(event) => {
if (isFlippable && !flipped) {
setFlipped(true);
if (isFlippable && !isFlipped) {
onFlip && onFlip(day, true);
event.preventDefault();
} else {
Expand All @@ -42,15 +39,17 @@ export function FlipCard({
}}
className={cx(
'block group perspective',
isFlippable && !flipped ? 'cursor-pointer' : 'cursor-default'
isFlippable && !isFlipped ? 'cursor-pointer' : 'cursor-default'
)}
>
<div
className={cx(
'relative preserve-3d transition w-full h-full duration-200 content-center rounded-lg border-2 shadow-sm focus-within:ring-offset-2 bg-white/60 dark:bg-slate-800/90',
flipped ? 'my-rotate-y-180 bg-white dark:bg-slate-800' : '',
isFlippable && isFlipped
? 'my-rotate-y-180 bg-white dark:bg-slate-800'
: '',
isFlippable
? flipped
? isFlipped
? 'border-blue-400 dark:border-slate-800'
: 'border-blue-400 dark:border-slate-800 hover:[transform:rotateY(10deg)]'
: 'border-1 border-slate-300 dark:border-slate-800'
Expand Down

1 comment on commit 530711d

@vercel
Copy link

@vercel vercel bot commented on 530711d Jan 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-five.vercel.app
nx-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx.dev

Please sign in to comment.