Skip to content

Commit

Permalink
fix: forgot to use css modules for classnames
Browse files Browse the repository at this point in the history
  • Loading branch information
haakemon committed May 16, 2022
1 parent b62aea6 commit 4d3c258
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
5 changes: 5 additions & 0 deletions custom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ declare module '*.svg' {
const src: string;
export default src;
}

declare module '*.css' {
const styles: { [className: string]: string };
export default styles;
}
24 changes: 15 additions & 9 deletions src/components/Panel/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ReactComponent as SuccessIcon } from './success.svg';

import { tokens } from '../../DesignTokens';

import './Panel.module.css';
import classes from './Panel.module.css';

// TODO: Should not import tokens directly in the components
// eslint-disable-next-line
Expand Down Expand Up @@ -62,30 +62,36 @@ export const Panel = ({

return (
<div
className={cn('panel', {
'panel--has-pointer': showPointer,
className={cn(classes.panel, {
[classes['panel--has-pointer']]: showPointer,
})}
>
{showPointer && (
<div
data-testid='panel-pointer'
className={cn('panel__pointer', `panel__pointer--${variant}`)}
className={cn(
classes.panel__pointer,
classes[`panel__pointer--${variant}`],
)}
></div>
)}

<div
className={cn(
'panel__content-wrapper',
`panel__content-wrapper--${variant}`,
classes['panel__content-wrapper'],
classes[`panel__content-wrapper--${variant}`],
)}
>
{showIcon && (
<div data-testid='panel-icon-wrapper' className='panel__icon-wrapper'>
<div
data-testid='panel-icon-wrapper'
className={classes['panel__icon-wrapper']}
>
{renderIcon({ size: iconSize, variant })}
</div>
)}
<div className='panel__content'>
<h3 className='panel__header'>{title}</h3>
<div className={classes.panel__content}>
<h3 className={classes.panel__header}>{title}</h3>
<div>{children}</div>
</div>
</div>
Expand Down

0 comments on commit 4d3c258

Please sign in to comment.