-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: islxyqwe <[email protected]>
- Loading branch information
Showing
13 changed files
with
221 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
export default function LimitSetting(props: { value: number; setValue: (v: number) => void }) { | ||
const { t } = useTranslation('translation', { keyPrefix: 'main.tabpanel.settings' }); | ||
|
||
return ( | ||
<div className=" mt-2"> | ||
<input | ||
className="w-full h-2 bg-blue-100 appearance-none" | ||
type="range" | ||
name="limit" | ||
value={props.value > 0 ? props.value : 0} | ||
min="1" | ||
max="50" | ||
disabled={props.value < 0} | ||
step="1" | ||
onChange={(e) => { | ||
const v = parseInt(e.target.value); | ||
if (!isNaN(v)) { | ||
props.setValue(v); | ||
} | ||
}} | ||
/> | ||
<output className="text-sm ml-1" htmlFor="height"> | ||
<input | ||
type="checkbox" | ||
className="h-4 w-4 mr-1 rounded border-gray-300 text-indigo-600 focus:ring-indigo-600" | ||
checked={props.value > 0} | ||
onChange={(e) => { | ||
props.setValue(e.target.checked ? 30 : -1); | ||
}} | ||
></input> | ||
{`${t('limit')}${props.value > 0 ? `: ${props.value}` : ''}`} | ||
</output> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { useState, useEffect } from 'react'; | ||
|
||
export function useDebounceValue<T>(value: T, timeout = 200): T { | ||
const [innerValue, setInnerValue] = useState(value); | ||
useEffect(() => { | ||
const handler = setTimeout(() => setInnerValue(value), timeout); | ||
return () => clearTimeout(handler); | ||
}, [value]); | ||
return innerValue; | ||
} |
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
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
Oops, something went wrong.
f46c0d7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
graphic-walker – ./
graphic-walker-app.vercel.app
graphic-walker-kanaries.vercel.app
graphic-walker.kanaries.net
graphic-walker-git-main-kanaries.vercel.app