Skip to content

Commit

Permalink
text input dark mode, header height
Browse files Browse the repository at this point in the history
  • Loading branch information
freirart committed May 1, 2024
1 parent 260cedd commit 6749202
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function Header({
};

return (
<header className="flex justify-center md:pt-10">
<header className="flex flex-col justify-center items-center h-1/5">
<div
className="flex justify-between flex-nowrap dark:bg-dark-blue bg-white-blue
md:min-w-[500px] w-[350px] rounded-3xl p-2 md:text-xl shadow-md"
Expand All @@ -68,7 +68,7 @@ export default function Header({
>
{signMap[playerId]}
{isEditingPlayer ? (
<TextInput defaultValue={name} onBlur={onBlur} />
<TextInput onBlur={onBlur} defaultValue={name} />
) : (
<span
onClick={() => setPlayerBeingEdited(playerId)}
Expand Down
9 changes: 5 additions & 4 deletions src/components/TextInput/TextInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FocusEventHandler, useState } from 'react';
import { useState } from 'react';

interface TextInputProps {
onBlur: Function;
Expand All @@ -9,15 +9,16 @@ export default function TextInput({
onBlur,
defaultValue
}: TextInputProps) {
const [inputValue, setInputValue] = useState<string>(defaultValue);
const [inputValue, setInputValue] = useState<string>('');

return (
<input
autoFocus
onBlur={() => onBlur(inputValue)}
onBlur={() => onBlur(inputValue || defaultValue)}
onKeyDown={(e) => (e.key === 'Enter' ? onBlur(inputValue) : {})}
type="text"
className="md:w-36 w-24 text-center bg-light-blue"
className="md:w-36 w-24 text-center dark:bg-special-black bg-light-blue
dark:text-white-blue"
value={inputValue}
onChange={(e) => setInputValue(e.target.value)}
/>
Expand Down

0 comments on commit 6749202

Please sign in to comment.