From 9c09223de45a2fd85d11b14a4b85c72bc355e3de Mon Sep 17 00:00:00 2001 From: itryapitsin Date: Tue, 25 Feb 2020 11:08:18 +0200 Subject: [PATCH] fix(core): pass blockName function into withBemMod --- packages/core/core.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/core.tsx b/packages/core/core.tsx index 54fa8af0..2d9b99a5 100644 --- a/packages/core/core.tsx +++ b/packages/core/core.tsx @@ -13,7 +13,7 @@ export type Enhance = ( type Dictionary = { [key: string]: T } export function withBemMod( - blockName: string, + blockName: string | ClassNameFormatter, mod: NoStrictEntityMods, enhance?: Enhance, ) { @@ -27,7 +27,7 @@ export function withBemMod( // Use cache to prevent create new component when props are changed. let ModifiedComponent: ComponentType let modifierClassName: string - entity = entity || cn(blockName) + entity = entity || (typeof blockName === 'function' ? blockName : cn(blockName)) entityClassName = entityClassName || entity() function BemMod(props: T & K) {