Skip to content

Commit

Permalink
feat(amount): add default styles
Browse files Browse the repository at this point in the history
  • Loading branch information
reme3d2y committed Mar 30, 2022
1 parent f60a499 commit bcf85fa
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/amount/src/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export const Amount: React.FC<AmountProps> = ({
minority,
currency,
view = 'default',
bold = 'major',
transparentMinor = true,
bold,
transparentMinor,
rightAddons,
showPlus = false,
className,
Expand All @@ -28,11 +28,14 @@ export const Amount: React.FC<AmountProps> = ({
view,
});

const defaultStyles = bold === undefined && transparentMinor === undefined;

return (
<span
className={cn(styles.component, className, {
[styles.bold]: bold === 'full',
[styles.boldMajor]: bold === 'major',
[styles.default]: defaultStyles,
})}
data-test-id={dataTestId}
>
Expand All @@ -42,6 +45,7 @@ export const Amount: React.FC<AmountProps> = ({
className={cn(styles.minorPartAndCurrency, {
[styles.transparentMinor]: transparentMinor,
[styles.normalMinor]: bold === 'major',
[styles.defaultMinor]: defaultStyles,
})}
>
{minorPart && AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR}
Expand Down
15 changes: 15 additions & 0 deletions packages/amount/src/index.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
@import '../../themes/src/default.css';

:root {
--amount-major-part-font-weight: bold;
--amount-minor-part-font-weight: normal;
--amount-minor-part-opacity: 0.6;
}

.component {
white-space: nowrap;
}
Expand All @@ -19,3 +25,12 @@
.normalMinor {
font-weight: normal;
}

.default {
font-weight: var(--amount-major-part-font-weight);
}

.defaultMinor {
opacity: var(--amount-minor-part-opacity);
font-weight: var(--amount-minor-part-font-weight);
}
2 changes: 2 additions & 0 deletions packages/themes/src/mixins/click.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import './amount/click.css';
@import './form-control/click.css';
@import './input/click.css';
@import './button/click.css';
Expand Down Expand Up @@ -49,4 +50,5 @@
@mixin dropzone-click;
@mixin code-input-click;
@mixin bottom-sheet-click;
@mixin amount-click;
}

0 comments on commit bcf85fa

Please sign in to comment.