md: '2rem',
};
+const SIZE_IN_LOC = {
+ xs: 1000,
+ sm: 10_000,
+ md: 100_000,
+ l: 500_000,
+};
+
export function SizeIndicator({ size = 'sm', value }: Props) {
let letter: SizeLabel;
- if (inRange(value, 0, 1000)) {
+ if (inRange(value, 0, SIZE_IN_LOC.xs)) {
letter = 'XS';
- } else if (inRange(value, 1000, 10000)) {
+ } else if (inRange(value, SIZE_IN_LOC.xs, SIZE_IN_LOC.sm)) {
letter = 'S';
- } else if (inRange(value, 10000, 100000)) {
+ } else if (inRange(value, SIZE_IN_LOC.sm, SIZE_IN_LOC.md)) {
letter = 'M';
- } else if (inRange(value, 100000, 500000)) {
+ } else if (inRange(value, SIZE_IN_LOC.md, SIZE_IN_LOC.l)) {
letter = 'L';
} else {
letter = 'XL';
const canUpdateTags = () => {
const { configuration } = props.component;
- return configuration && configuration.showSettings;
+ return configuration?.showSettings;
};
const setTags = (values: string[]) => {
);
};
- const tags = props.component.tags || [];
+ const tags = props.component.tags ?? [];
return (
<>
}
const LIST_SIZE = 10;
+const MAX_LIST_SIZE = 100;
function MetaTagsSelector({ selectedTags, setProjectTags }: MetaTagsSelectorProps) {
const [searchResult, setSearchResult] = useState<string[]>([]);
const onSearch = (query: string) => {
return searchProjectTags({
q: query,
- ps: Math.min(selectedTags.length - 1 + LIST_SIZE, 100),
+ ps: Math.min(selectedTags.length - 1 + LIST_SIZE, MAX_LIST_SIZE),
}).then(
({ tags }) => setSearchResult(tags),
() => {}