Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(badge): css changes and data attrs #2391

Merged
merged 5 commits into from
Sep 13, 2024
Merged

feat(badge): css changes and data attrs #2391

merged 5 commits into from
Sep 13, 2024

Conversation

Barsnes
Copy link
Member

@Barsnes Barsnes commented Sep 9, 2024

part of #2295

Copy link

changeset-bot bot commented Sep 9, 2024

🦋 Changeset detected

Latest commit: 3f5c590

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@digdir/designsystemet-css Patch
@digdir/designsystemet-react Patch
@digdir/designsystemet Patch
@digdir/designsystemet-theme Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Sep 9, 2024

Preview deployments for this pull request:

📖 Storybook 12. Sep 2024 - 08:22 (Norwegian time)

See all deployments at https://dev.designsystemet.no

Copy link
Contributor

github-actions bot commented Sep 9, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 63.99% 4657 / 7277
🔵 Statements 63.99% 4657 / 7277
🔵 Functions 84.61% 143 / 169
🔵 Branches 75.66% 594 / 785
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
packages/react/src/components/Badge/Badge.tsx 27.65% 100% 100% 27.65% 69-97, 99-102, 104
Generated in workflow #246

Copy link
Contributor

github-actions bot commented Sep 9, 2024

Preview deployments

Theme 12. Sep 2024 - 08:23 (Norwegian time)

@Barsnes Barsnes marked this pull request as ready for review September 9, 2024 06:41
&[data-placement='bottom-left'][data-overlap='circle'] {
bottom: 14%;
left: 14%;
transform: translateX(-50%) translateY(50%);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use the new CSS syntax? ☺️

Suggested change
transform: translateX(-50%) translateY(50%);
translate: -50% 50%;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS: by always using left+top (instead of right+bottom, i.e. right: 0 === left: 100%) we can simplify and always use translate: -50% -50% instead of changing this property for each placement :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel it's more readable to explicitly write X/Y. Is there any benefits do doing it shorthand?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS: by always using left+top (instead of right+bottom, i.e. right: 0 === left: 100%) we can simplify and always use translate: -50% -50% instead of changing this property for each placement :)

don't have anything against this, except that doing the actual two sides for positioning feels better to me..? :P
So when the placement is top-left, we actually change top and left

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel it's more readable to explicitly write X/Y. Is there any benefits do doing it shorthand?

By using translate directly, we enable using rotate, scale, transform independently, while using transform groups all these properties in one declaration, making it harder to do separate transforms. translate is actually the full version while transform is more of a shorthand as it nulls out the others (and can cause unwanted issues if not being aware of value order). In this particular scenario it does not make much difference, but my experience it is just better to use individual transform properties as a default ☺️
More info: https://web.dev/articles/css-individual-transform-properties

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS: by always using left+top (instead of right+bottom, i.e. right: 0 === left: 100%) we can simplify and always use translate: -50% -50% instead of changing this property for each placement :)

don't have anything against this, except that doing the actual two sides for positioning feels better to me..? :P So when the placement is top-left, we actually change top and left

No strong feelings, just a suggestion to simplify by not needing to change translate ☺️

@mimarz mimarz merged commit a0b119d into next Sep 13, 2024
6 checks passed
@mimarz mimarz deleted the css/badge branch September 13, 2024 08:15
mimarz pushed a commit that referenced this pull request Sep 17, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to next, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`next` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `next`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @digdir/designsystemet-css@1.0.0-next.33

### Patch Changes

- Pagination: Use data attrs instead of class names
([#2395](#2395))

- Badge: Style using css attributes
([#2391](#2391))

- TableHeaderCell: Remove `sortable` prop, `sort` now handles this
([#2393](#2393))

- dropdownmenu: Style using data attributes
([#2387](#2387))

- Chip: Text color is now `accent`
([#2371](#2371))

- List: Remove `List.Root` and `List.Heading`, which changes API
([#2348](#2348))

- Alert, Avatar, Button, Divider, Link: Use data-attributes for variant,
size and color and move icons to CSS
([#2313](#2313))

- Box: Remove component
([#2372](#2372))

- Popover: ([#2369](#2369))

    -   Rename `<Popover.Root>` to `<Popover.Context>`
- use Popover API, allowing `<Popover>` to be used without
`Popover.Context`
    -   Remove `portal` prop

- Tooltip: Only expose background css variable
([#2389](#2389))

- Switch: don't show check when not checked in readonly
([#2377](#2377))

- Select: Rename from `NativeSelect`
([#2404](#2404))

- Accordion: Now uses details and summary HTML elements
([`5d1c5062b526e6829c322ce66c6df08568bb9f63`](5d1c506))

- Spinner: Style using data attributes
([#2390](#2390))

- Avatar: new component
([#2312](#2312))

- Tag: Make neutral default color in CSS
([#2397](#2397))

- Card: Use data attrs
([#2398](#2398))

## @digdir/designsystemet-react@1.0.0-next.33

### Patch Changes

- Pagination: Use data attrs instead of class names
([#2395](#2395))

- Badge: Style using css attributes
([#2391](#2391))

- TableHeaderCell: Remove `sortable` prop, `sort` now handles this
([#2393](#2393))

- dropdownmenu: Style using data attributes
([#2387](#2387))

- List: Remove `List.Root` and `List.Heading`, which changes API
([#2348](#2348))

- Alert, Avatar, Button, Divider, Link: Use data-attributes for variant,
size and color and move icons to CSS
([#2313](#2313))

- Box: Remove component
([#2372](#2372))

- Popover: ([#2369](#2369))

    -   Rename `<Popover.Root>` to `<Popover.Context>`
- use Popover API, allowing `<Popover>` to be used without
`Popover.Context`
    -   Remove `portal` prop

- Select: Rename from `NativeSelect`
([#2404](#2404))

- Table: Set sort button type to prevent form submit
([#2402](#2402))

- Heading: default level is now 2
([#2378](#2378))

- Select: ([#2415](#2415))

    -   Add Select.Option and Select.Optgroup compond components
    -   Remove `multiple` prop

- Accordion: Now uses details and summary HTML elements
([`5d1c5062b526e6829c322ce66c6df08568bb9f63`](5d1c506))

- Spinner: Style using data attributes
([#2390](#2390))

- Avatar: new component
([#2312](#2312))

- Tag: Make neutral default color in CSS
([#2397](#2397))

- Card: Use data attrs
([#2398](#2398))

- Combobox: fix virtual combobox having large gap between items
([#2376](#2376))

## @digdir/designsystemet@1.0.0-next.33



## @digdir/designsystemet-theme@1.0.0-next.33

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
mimarz pushed a commit that referenced this pull request Feb 21, 2025
part of #2295

---------

Co-authored-by: Eirik Backer <eirik.backer@gmail.com>
mimarz pushed a commit that referenced this pull request Feb 21, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to next, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`next` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `next`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @digdir/designsystemet-css@1.0.0-next.33

### Patch Changes

- Pagination: Use data attrs instead of class names
([#2395](#2395))

- Badge: Style using css attributes
([#2391](#2391))

- TableHeaderCell: Remove `sortable` prop, `sort` now handles this
([#2393](#2393))

- dropdownmenu: Style using data attributes
([#2387](#2387))

- Chip: Text color is now `accent`
([#2371](#2371))

- List: Remove `List.Root` and `List.Heading`, which changes API
([#2348](#2348))

- Alert, Avatar, Button, Divider, Link: Use data-attributes for variant,
size and color and move icons to CSS
([#2313](#2313))

- Box: Remove component
([#2372](#2372))

- Popover: ([#2369](#2369))

    -   Rename `<Popover.Root>` to `<Popover.Context>`
- use Popover API, allowing `<Popover>` to be used without
`Popover.Context`
    -   Remove `portal` prop

- Tooltip: Only expose background css variable
([#2389](#2389))

- Switch: don't show check when not checked in readonly
([#2377](#2377))

- Select: Rename from `NativeSelect`
([#2404](#2404))

- Accordion: Now uses details and summary HTML elements
([`5d1c5062b526e6829c322ce66c6df08568bb9f63`](5d1c506))

- Spinner: Style using data attributes
([#2390](#2390))

- Avatar: new component
([#2312](#2312))

- Tag: Make neutral default color in CSS
([#2397](#2397))

- Card: Use data attrs
([#2398](#2398))

## @digdir/designsystemet-react@1.0.0-next.33

### Patch Changes

- Pagination: Use data attrs instead of class names
([#2395](#2395))

- Badge: Style using css attributes
([#2391](#2391))

- TableHeaderCell: Remove `sortable` prop, `sort` now handles this
([#2393](#2393))

- dropdownmenu: Style using data attributes
([#2387](#2387))

- List: Remove `List.Root` and `List.Heading`, which changes API
([#2348](#2348))

- Alert, Avatar, Button, Divider, Link: Use data-attributes for variant,
size and color and move icons to CSS
([#2313](#2313))

- Box: Remove component
([#2372](#2372))

- Popover: ([#2369](#2369))

    -   Rename `<Popover.Root>` to `<Popover.Context>`
- use Popover API, allowing `<Popover>` to be used without
`Popover.Context`
    -   Remove `portal` prop

- Select: Rename from `NativeSelect`
([#2404](#2404))

- Table: Set sort button type to prevent form submit
([#2402](#2402))

- Heading: default level is now 2
([#2378](#2378))

- Select: ([#2415](#2415))

    -   Add Select.Option and Select.Optgroup compond components
    -   Remove `multiple` prop

- Accordion: Now uses details and summary HTML elements
([`5d1c5062b526e6829c322ce66c6df08568bb9f63`](5d1c506))

- Spinner: Style using data attributes
([#2390](#2390))

- Avatar: new component
([#2312](#2312))

- Tag: Make neutral default color in CSS
([#2397](#2397))

- Card: Use data attrs
([#2398](#2398))

- Combobox: fix virtual combobox having large gap between items
([#2376](#2376))

## @digdir/designsystemet@1.0.0-next.33



## @digdir/designsystemet-theme@1.0.0-next.33

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants