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

Feat: Done! with theme color #81

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion src/components/molecule_action_group_card/index.buttons.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import StyledCircularButtonAtom from '@/atoms/StyledCircularButton'
import { usePostActionByActionGroupId } from '@/hooks/action-group/use-post-action-by-action-group-id.hook'
import { isActionGroupPunchableSelector } from '@/recoil/action-groups/action-groups.selectors'
import { getDoneColorLambda } from '@/lambdas/get-app-theme-color.lambda'
import { appThemeState } from '@/recoil/app-theme/app-theme.state'
import { FC } from 'react'
import { useRecoilValue } from 'recoil'

Expand All @@ -11,6 +13,7 @@ const ActionGroupCardButton: FC<Props> = ({ id }) => {
const isActionGroupPunchable = useRecoilValue(
isActionGroupPunchableSelector(id),
)
const appTheme = useRecoilValue(appThemeState)
const [loading, onPostActionByActionGroupId] =
usePostActionByActionGroupId(id)

Expand All @@ -20,7 +23,7 @@ const ActionGroupCardButton: FC<Props> = ({ id }) => {
<StyledCircularButtonAtom
onClick={onPostActionByActionGroupId}
radius={80}
bgColor="green" // TODO: Just learned that the #XXXXXX works here xDD
bgColor={getDoneColorLambda(appTheme)}
title="Done!"
loading={loading}
typoProps={{
Expand Down
14 changes: 14 additions & 0 deletions src/lambdas/get-app-theme-color.lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,17 @@ export const getButtonColorLambda = (
}
}
}

/**
* Color for the done button
*/
export const getDoneColorLambda = (theme?: AppTheme): string => {
switch (theme) {
case AppTheme.Halloween:
return Halloween.five
case AppTheme.Christmas:
return Christmas.five
default:
return `green`
}
}
Loading