mirror of
https://github.com/towfiqi/serpbear
synced 2025-06-26 18:15:54 +00:00
- Replaces useEffet with useMemo & useLayoutEffect where necessary. - Converts some useEffects to separate hooks. - Moves the functions defined within components to utils. - Splits the Keywords renderPosition function to its own component.
20 lines
558 B
TypeScript
20 lines
558 B
TypeScript
import Icon from '../common/Icon';
|
|
|
|
type KeywordPositionProps = {
|
|
position: number,
|
|
updating?: boolean,
|
|
type?: string,
|
|
}
|
|
|
|
const KeywordPosition = ({ position = 0, type = '', updating = false }:KeywordPositionProps) => {
|
|
if (!updating && position === 0) {
|
|
return <span className='text-gray-400' title='Not in Top 100'>{'>100'}</span>;
|
|
}
|
|
if (updating && type !== 'sc') {
|
|
return <span title='Updating Keyword Position'><Icon type="loading" /></span>;
|
|
}
|
|
return <>{Math.round(position)}</>;
|
|
};
|
|
|
|
export default KeywordPosition;
|