Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Improve Activity Library focus and hover states #9626

Merged
merged 7 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const ActivityCard = (props: ActivityCardProps) => {

return (
<div
className='flex w-full flex-col'
className='flex w-full flex-col rounded-xl p-2'
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
>
Expand Down
9 changes: 4 additions & 5 deletions packages/client/components/ActivityLibrary/ActivityGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from 'react'
import {Link} from 'react-router-dom'
import {ActivityBadge} from './ActivityBadge'
import {ActivityCardImage} from './ActivityCard'
import {ActivityCard, ActivityCardImage} from './ActivityCard'
import {Template} from './ActivityLibrary'
import {ActivityLibraryCard} from './ActivityLibraryCard'
import {ActivityLibraryCardDescription} from './ActivityLibraryCardDescription'
import {CATEGORY_THEMES, CategoryID} from './Categories'

Expand All @@ -23,9 +22,9 @@ const ActivityGrid = ({templates, selectedCategory}: ActivityGridProps) => {
pathname: `/activity-library/details/${template.id}`,
state: {prevCategory: selectedCategory}
}}
className='flex focus:rounded-md focus:outline-primary'
className='flex rounded-2xl hover:bg-slate-100 focus:outline-sky-500'
>
<ActivityLibraryCard
<ActivityCard
className='group aspect-[256/160] flex-1'
key={template.id}
theme={CATEGORY_THEMES[template.category as CategoryID]}
Expand All @@ -47,7 +46,7 @@ const ActivityGrid = ({templates, selectedCategory}: ActivityGridProps) => {
className='hidden group-hover/card:flex'
templateRef={template}
/>
</ActivityLibraryCard>
</ActivityCard>
</Link>
)
})}
Expand Down
14 changes: 0 additions & 14 deletions packages/client/components/ActivityLibrary/ActivityLibraryCard.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import clsx from 'clsx'
import React from 'react'
import {Link} from 'react-router-dom'
import {ActivityBadge} from './ActivityBadge'
import {ActivityLibraryCard} from './ActivityLibraryCard'
import {ActivityCard} from './ActivityCard'
import {AllCategoryID, CATEGORY_ID_TO_NAME, CATEGORY_THEMES} from './Categories'

interface Props {
Expand All @@ -15,8 +15,11 @@ const CreateActivityCard = (props: Props) => {
const {category, className} = props

return (
<Link className={clsx('flex', className)} to={`/activity-library/new-activity/${category}`}>
<ActivityLibraryCard
<Link
className={clsx('flex rounded-2xl hover:bg-slate-100 focus:outline-sky-500', className)}
to={`/activity-library/new-activity/${category}`}
>
<ActivityCard
className={'flex-1 cursor-pointer'}
theme={CATEGORY_THEMES[category]}
badge={<ActivityBadge className='m-2 bg-gold-300 text-grape-700'>Premium</ActivityBadge>}
Expand All @@ -27,7 +30,7 @@ const CreateActivityCard = (props: Props) => {
</div>
Create Custom {category !== 'recommended' ? CATEGORY_ID_TO_NAME[category] : ''} Activity
</div>
</ActivityLibraryCard>
</ActivityCard>
</Link>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,11 @@ export const CreateNewActivity = (props: Props) => {
return (
<RadioGroup.Item
key={activity.title}
className='group flex cursor-pointer flex-col items-start space-y-3 rounded-lg bg-transparent p-1 focus:outline-none'
className='group flex cursor-pointer flex-col items-start space-y-3 rounded-2xl bg-transparent p-1 pb-4 hover:bg-slate-100 focus:outline-sky-500 data-[state=checked]:ring-4 data-[state=checked]:ring-sky-500'
value={activity.type}
>
<ActivityCard
className='aspect-[320/190] w-80 group-data-[state=checked]:ring-4 group-data-[state=checked]:ring-sky-500 group-data-[state=checked]:ring-offset-4'
className='aspect-[320/190] w-80'
theme={DEFAULT_CARD_THEME}
title={activity.title}
type={activity.type}
Expand Down
47 changes: 24 additions & 23 deletions packages/client/components/RetroDrawerTemplateCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import useMutationProps from '../hooks/useMutationProps'
import UpdateMeetingTemplateMutation from '../mutations/UpdateMeetingTemplateMutation'
import {CATEGORY_THEMES, CategoryID} from '././ActivityLibrary/Categories'
import {ActivityBadge} from './ActivityLibrary/ActivityBadge'
import {ActivityCardImage} from './ActivityLibrary/ActivityCard'
import {ActivityLibraryCard} from './ActivityLibrary/ActivityLibraryCard'
import {ActivityCard, ActivityCardImage} from './ActivityLibrary/ActivityCard'
import {ActivityLibraryCardDescription} from './ActivityLibrary/ActivityLibraryCardDescription'

interface Props {
Expand Down Expand Up @@ -49,27 +48,29 @@ const RetroDrawerTemplateCard = (props: Props) => {

return (
<form className='px-4 py-2' onClick={handleClick}>
<ActivityLibraryCard
className='group aspect-[256/160] flex-1 hover:cursor-pointer'
theme={CATEGORY_THEMES[template.category as CategoryID]}
title={template.name}
type='retrospective'
badge={
!template.isFree ? (
<ActivityBadge className='m-2 bg-gold-300 text-grape-700'>Premium</ActivityBadge>
) : null
}
>
<ActivityCardImage
className='group-hover/card:hidden'
src={template.illustrationUrl}
category='retrospective'
/>
<ActivityLibraryCardDescription
className='hidden group-hover/card:flex'
templateRef={template}
/>
</ActivityLibraryCard>
<div className='flex hover:rounded-2xl hover:bg-slate-100 focus:rounded-2xl focus:outline-sky-500'>
<ActivityCard
className='group aspect-[256/160] flex-1 hover:cursor-pointer'
theme={CATEGORY_THEMES[template.category as CategoryID]}
title={template.name}
type='retrospective'
badge={
!template.isFree ? (
<ActivityBadge className='m-2 bg-gold-300 text-grape-700'>Premium</ActivityBadge>
) : null
}
>
<ActivityCardImage
className='group-hover/card:hidden'
src={template.illustrationUrl}
category='retrospective'
/>
<ActivityLibraryCardDescription
className='hidden group-hover/card:flex'
templateRef={template}
/>
</ActivityCard>
</div>
</form>
)
}
Expand Down
Loading