-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added an empty state when searching
- tweaks to the app image. - slight tweaks to colors based upon the background gradient changes
- Loading branch information
1 parent
b7040af
commit 6479cea
Showing
20 changed files
with
149 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
.buttons { | ||
@apply grid grid-cols-[repeat(3,minmax(min-content,1fr))]; | ||
@apply grid grid-flow-col; | ||
/* @apply flex gap-[1px] flex-wrap; */ | ||
|
||
> * { | ||
@apply rounded-none flex-grow; | ||
} | ||
|
||
&.vertical { | ||
@apply flex-col; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
src/components/Input.module.css → src/components/Code.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
.input { | ||
@apply relative; | ||
|
||
.code { | ||
&:not(.disabled) { | ||
&:after { | ||
content: ''; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,41 @@ | ||
import { type FC, type ComponentProps } from 'react'; | ||
import { cn } from '../utils/cn'; | ||
import * as styles from './Input.module.css'; | ||
import { X } from 'lucide-react'; | ||
import { useCachedState } from '@rain-cafe/react-utils'; | ||
|
||
type Props = { | ||
onChange?: (value: string) => void; | ||
} & Pick<ComponentProps<'input'>, 'value' | 'placeholder' | 'disabled'>; | ||
|
||
export const Input: FC<Props> = ({ onChange, ...props }) => { | ||
export const Input: FC<Props> = ({ onChange: externalOnChange, value: externalValue, ...props }) => { | ||
const [value, setValue] = useCachedState(() => externalValue, [externalValue]); | ||
|
||
const onChange = (value: string) => { | ||
setValue(value); | ||
externalOnChange?.(value); | ||
}; | ||
|
||
return ( | ||
<div | ||
className={cn(styles.input, 'flex-1 bg-accent rounded-md min-h-12 text-xl', props.disabled && styles.disabled)} | ||
> | ||
<div className={'relative flex-1 min-h-12 bg-accent rounded-md overflow-hidden'}> | ||
<input | ||
{...props} | ||
type="text" | ||
className={cn('h-full w-full bg-transparent px-3 rounded-md')} | ||
onChange={(e) => onChange?.(e.target.value)} | ||
className={cn( | ||
'h-full w-full bg-transparent px-3 text-xl transition-all', | ||
props.disabled ? 'text-white/20 pointer-events-none' : 'hover:bg-white/10' | ||
)} | ||
value={value} | ||
onChange={(e) => onChange(e.target.value)} | ||
/> | ||
<button | ||
className={cn( | ||
'absolute right-4 top-1/2 -translate-y-1/2 rounded-full bg-white/10 hover:bg-white/20 p-1 pointer-events-none opacity-0 transition-opacity', | ||
value && 'pointer-events-auto opacity-100' | ||
)} | ||
onClick={() => onChange('')} | ||
> | ||
<X /> | ||
</button> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { useState, type FC, type ReactNode, useEffect } from 'react'; | ||
import { CircleCheck, LoaderIcon } from 'lucide-react'; | ||
import { cn } from '@/utils/cn'; | ||
import { delay } from '@rain-cafe/js-utils'; | ||
|
||
type Props = { | ||
children: ReactNode; | ||
loading: boolean; | ||
className?: string; | ||
}; | ||
|
||
enum LoadingState { | ||
NOT_STARTED, | ||
LOADING, | ||
FINISHED, | ||
} | ||
|
||
export const Spinner: FC<Props> = ({ children, loading, className }) => { | ||
const [state, setState] = useState(LoadingState.NOT_STARTED); | ||
|
||
useEffect(() => { | ||
if (loading) setState(LoadingState.LOADING); | ||
else if (state === LoadingState.LOADING) { | ||
setState(LoadingState.FINISHED); | ||
|
||
setTimeout(() => { | ||
setState(LoadingState.NOT_STARTED); | ||
}, 500); | ||
} | ||
}, [loading]); | ||
|
||
if (state === LoadingState.LOADING) return <LoaderIcon className={cn('text-white/20 animate-spin', className)} />; | ||
else if (state === LoadingState.FINISHED) return <CircleCheck className={className} />; | ||
return children; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters