@carbon/ibm-products
Version:
Carbon for IBM Products
28 lines (26 loc) • 941 B
JavaScript
/**
* Copyright IBM Corp. 2020, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import { baseFontSize, sizeLarge, sizeMedium, sizeSmall, sizeXSmall } from "@carbon/layout";
//#region src/components/DataSpreadsheet/utils/getCellSize.js
/**
* Copyright IBM Corp. 2022, 2022
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const getSizeInPixels = (carbonSize) => Number(carbonSize.replace("rem", "") * baseFontSize);
const getCellSize = (cellSize) => {
switch (cellSize) {
case "xs": return getSizeInPixels(sizeXSmall);
case "sm": return getSizeInPixels(sizeSmall);
case "md": return getSizeInPixels(sizeMedium);
case "lg": return getSizeInPixels(sizeLarge);
default: return getSizeInPixels(sizeSmall);
}
};
//#endregion
export { getCellSize };