Skip to content

Commit

Permalink
feat(card): allow adjusting card body padding via CSS var
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-solanki committed Jun 7, 2023
1 parent 4ba3821 commit d450f1b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion docs/guide/components/card.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ If you pass `text` prop directly on `ACard` then `ACard` will add `text-sm` clas
This way if you want 16px font for your card text instead of 14px you can omit adding `text-sm` to `p` tag;
:::

:::tip
:::tip Adjusting card body padding
You can adjust the padding to applied by `a-card-body` using `--a-card-padding` CSS variable.
:::

:::tip Adjusting card spacer margin
You can customize the applied `margin-bottom` by configuring `--a-card-spacer` CSS variable.
:::

Expand Down
1 change: 1 addition & 0 deletions packages/preset-theme-default/src/scss/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ body {

// 馃憠 Card
--a-card-spacer: 1em;
--a-card-padding: 1.25em;

// 馃憠 Spinner
--a-spinner-size: 1.25em;
Expand Down
2 changes: 1 addition & 1 deletion packages/preset-theme-default/src/shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const shortcuts: Exclude<Preset['shortcuts'], undefined | StaticShortcutMap> = [
// 馃憠 Card
'a-card': 'em:spacing:rounded-lg shadow-lg em:[&_>_.a-loader_.a-spinner]-w-7',
'a-card-typography-wrapper': 'a-card-padding next:pt-0 em:spacing:not-last:pb-4',
'a-card-padding': 'em:spacing:p-5',
'a-card-padding': 'em:spacing:p-$a-card-padding',
'a-card-spacer': 'not-last-children-mb-$a-card-spacer',
'a-card-body': 'a-card-padding',

Expand Down

0 comments on commit d450f1b

Please sign in to comment.