remove density mentions
Summary: removing dead code Reviewed By: lblasa Differential Revision: D50495989 fbshipit-source-id: 769f853b50bf6ec48705dbcec03977ec6a5bffa3
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a978c96987
commit
fd774a2d52
@@ -11,19 +11,16 @@ import {getRenderHostInstance} from 'flipper-frontend-core';
|
||||
import {IconSize} from '../ui/components/Glyph';
|
||||
|
||||
const AVAILABLE_SIZES: IconSize[] = [8, 10, 12, 16, 18, 20, 24, 28, 32, 48];
|
||||
const DENSITIES = [1, 1.5, 2, 3, 4];
|
||||
|
||||
export type Icon = {
|
||||
name: string;
|
||||
variant: 'outline' | 'filled';
|
||||
size: IconSize;
|
||||
density: number;
|
||||
};
|
||||
|
||||
function normalizeIcon(icon: Icon): Icon {
|
||||
let {size, density} = icon;
|
||||
let requestedSize = size as number;
|
||||
if (!AVAILABLE_SIZES.includes(size as any)) {
|
||||
let requestedSize = icon.size as number;
|
||||
if (!AVAILABLE_SIZES.includes(icon.size as any)) {
|
||||
// find the next largest size
|
||||
const possibleSize = AVAILABLE_SIZES.find((size) => {
|
||||
return size > requestedSize;
|
||||
@@ -37,24 +34,9 @@ function normalizeIcon(icon: Icon): Icon {
|
||||
}
|
||||
}
|
||||
|
||||
if (!DENSITIES.includes(density)) {
|
||||
// find the next largest size
|
||||
const possibleDensity = DENSITIES.find((scale) => {
|
||||
return scale > density;
|
||||
});
|
||||
|
||||
// set to largest size if the real size is larger than what we have
|
||||
if (possibleDensity == null) {
|
||||
density = Math.max(...DENSITIES);
|
||||
} else {
|
||||
density = possibleDensity;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
...icon,
|
||||
size: requestedSize as IconSize,
|
||||
density,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user