-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Scroll Button Component and Integrate into Chat Settings
- Loading branch information
Showing
6 changed files
with
46 additions
and
2 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
1 change: 0 additions & 1 deletion
1
client/src/components/Nav/SettingsTabs/Chat/MaximizeChatSpace.tsx
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
35 changes: 35 additions & 0 deletions
35
client/src/components/Nav/SettingsTabs/Chat/ScrollButton.tsx
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 { useRecoilState } from 'recoil'; | ||
import { Switch } from '~/components/ui/Switch'; | ||
import useLocalize from '~/hooks/useLocalize'; | ||
import store from '~/store'; | ||
|
||
export default function ScrollButton({ | ||
onCheckedChange, | ||
}: { | ||
onCheckedChange?: (value: boolean) => void; | ||
}) { | ||
const [showScrollButton, setShowScrollButton] = useRecoilState<boolean>(store.showScrollButton); | ||
const localize = useLocalize(); | ||
|
||
const handleCheckedChange = (value: boolean) => { | ||
setShowScrollButton(value); | ||
if (onCheckedChange) { | ||
onCheckedChange(value); | ||
} | ||
}; | ||
|
||
return ( | ||
<div className="flex items-center justify-between"> | ||
<div className="flex items-center space-x-2"> | ||
<div>{localize('com_nav_scroll_button')}</div> | ||
</div> | ||
<Switch | ||
id="scrollButton" | ||
checked={showScrollButton} | ||
onCheckedChange={handleCheckedChange} | ||
className="ml-4" | ||
data-testid="scrollButton" | ||
/> | ||
</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