Skip to content

Commit

Permalink
Merge pull request #1 from joshfeinsilber/initial-release-patches
Browse files Browse the repository at this point in the history
Initial release patches
  • Loading branch information
joshfeinsilber authored May 13, 2024
2 parents d121440 + d6d7485 commit b57fe43
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
20 changes: 19 additions & 1 deletion src/components/keyboard/Key.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
import classNames from 'classnames'
import * as React from 'react'
import styled from 'styled-components'

type Props = React.PropsWithChildren<{
size: number
submit?: boolean
color?: {
bg?: string
activeBg?: string
text?: string
}
onClick?: () => void
}>

export const Key = (props: Props) => {
return (
<Container
className="transition-75 flex h-14 cursor-pointer items-center justify-center rounded bg-slate-300 font-semibold uppercase text-black transition-all active:bg-slate-400"
className={classNames(
`transition-75 flex h-14 cursor-pointer items-center justify-center rounded font-semibold uppercase transition-all`,
{
'text-black': !props.submit,
'bg-slate-300': !props.submit,
'active:bg-slate-400': !props.submit,

'text-white': props.submit,
'bg-green-600': props.submit,
'active:bg-green-700': props.submit
}
)}
style={{ flex: props.size }}
onClick={props.onClick}
>
Expand Down
7 changes: 6 additions & 1 deletion src/components/keyboard/Keyboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ export const Keyboard = (props: Props) => {
<Key
key={'key-' + (key.action.value ?? key.action.type)}
size={key.action.type !== IKeyActionType.letter ? 1.5 : 1}
onClick={() => props.onKeyPress?.(key.action)}
submit={key.action.type === IKeyActionType.submit}
onClick={() => {
props.onKeyPress?.(key.action)
// @ts-ignore
document.activeElement?.blur() // Blur focus on the button after clicking so that if we use the Enter key, it doesn't trigger the button again
}}
>
{key.content}
</Key>
Expand Down
2 changes: 1 addition & 1 deletion src/screens/results/Words.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const Words = () => {
const wordsUsed: string[] = useAtomValue(words)

return (
<div className="card mt-4 w-full bg-base-100 text-center shadow-xl">
<div className="card mt-4 w-full select-text bg-base-100 text-center shadow-xl">
<div className="card-body flex flex-col items-center">
<ul className="text-base">
{wordsUsed.map((word, index) => (
Expand Down
8 changes: 6 additions & 2 deletions src/util/results/share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ const resultText = () => {

text += `
`
word.split('').forEach(() => {
text += `${color}`
word.split('').forEach((letter, idx) => {
if (idx === 0) {
text += letter.toUpperCase()
} else {
text += `${color}`
}
})
})

Expand Down

0 comments on commit b57fe43

Please sign in to comment.