-
Notifications
You must be signed in to change notification settings - Fork 38
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
Preparations for CSS-package #2295
Comments
Some quick thoughs: Decrease amount of DOM:In the chip you have used as an example here, the wrappers are for icons, and to ensure children are in a singular Avoid display: flexI like the alternative, since using selectors like Avoid position: relative et.al.Agreed, we need it most places where it is set, but I see some examples where this should not be needed. Use ::before or ::after with mask: url(svg) for component graphicsAgreed, this has been on our radar, but have fallen through the cracks. We have already done it for some elements, such as Direct styling of input elementsThis is done to the input so we can adde prefixes and suffixes, not sure how you would solve this without a wrapper? Spacing as responsibility of parent elementThis will unfortunatley not work in some contexts, where users will need to add it manually themselves. I suggest having a parent element as an alternative, but not the only option. |
Right.. is this much used? We should brainstorm a bit on this 🙌
Could you elaborate on what contexts? :) |
We would in that case need to add .ds-button:not(.ds-button-only-icon) svg:first-child { ... }
.ds-button:not(.ds-button-only-icon) svg:last-child { ... } Luckly I don't think there are other elments this applies to, but that's the thing, do we 100% know that we have crossed all the boxes with this? 🤔
I believe this is used yes, but I also believe this comes from the old design system it was built on.
To word myself a bit differently, why should we lock someone into always having to use a wrapper around their text content, when the components themselves could solve it? Why would I need a wrapper if I just have a section with a heading and a paragraph, which would not need a wrapper to begin with. |
|
PS: looks like the danish designsystem does not require a wrapper, unless using prefix/suffix: https://designsystem.dk/komponenter/inputfelter/#prefix-og-suffix-kode |
Reading thourhg some of these, I would suggest dropping the |
Agreed 🙌 Stacking/gap is regardless maybe more domain specific, and quite easy to set up. If we want to provide a out-of-the-box-solution for this, we can rather launch this later |
I would rather suggest easy to copy examples as the way to go :) Gives us less to worry about, but we still give a solution to consumers |
Okay, so Radix, Tailwind, Chakra, Carbon, Shadcn, Ant and MUI all uses |
Updated with tasklist for todo components |
part of #2295 --------- Co-authored-by: Eirik Backer <[email protected]>
- Fixes #2100 🥳 - Deprecates #2176, #2190 - Built on top of `<u-details>` for [better accessibility on mobile](https://u-elements.github.io/u-elements/elements/u-details#accessibility) - Removes `level` from `AccordionHeader` as this is not supported by native `<details>` - Removes `onHeaderClick` from `AccordionHeader` as this is identical to adding a `onClick` handler - JS-based animation can be removed and replaced by CSS when `calc-size(auto)` is fully supported 🚀 - Fixes shrinking chevron on mobile/zoom - Fixes text-align in AccordionHeader on mobile/zoom - Follows: #2295 - Also works in `dir="rtl"` Question: It is now implemented so search-in-page only works when using `defaultOpen`, as a controlled `open` should not be affected by user interaction. Just checking - does this make sense to you guys as well? :)
part of #2295 I am not renaming anything is this PR. That belongs in it's own PR
- Part of #2295 --------- Co-authored-by: Tobias Barsnes <[email protected]>
Part of #2295 and #2221 Moves back link into `nav` as this make sense also from a11y perspective after discussion with NRK --------- Co-authored-by: Tobias Barsnes <[email protected]>
Part of #2295 --------- Co-authored-by: Tobias Barsnes <[email protected]>
- Part of #2295 - Awaiting doing `Paragraph` as we should convert to using `@composes` in other componentsbefore using data-attributes on paragraph
Closing this as completed. |
After meeting with @Barsnes @mimarz @Thunear @eirikbacker 26.08.24:
data-[property]="value"
instead of class names for variantsaria-
and pseudo selectors when relevantposition: relative
and change ofdisplay
unless necessary--dsc-link-color--hover
for state change instead changing of css properties directlycomposes
for font setup when feat: css modules #2318 is merged, but usefont-size
with comment in the meantimecomposes
for focus setup when feat: css modules #2318 is merged, but use--ds-focus-boxShadow
in the meantime--dsc-button-background--hover
with double dashes and state in the end for state based css custom propertiesmask: url(svg...)
instead of inline SVGs when graphic is part of the componentdata-size="md"
being set on every DOM elementTo be done after changes
Previous discussion topics
See previous discussion topics
### DescriptionStarting an issue to gather toughs:
Decrease amount of class names for each tag:
<button class="ds-btn ds-paragraph ds-paragraph--md ds-line-height--sm ds-focus ds-btn--md ds-btn--primary ds-btn--accent">
.ds.btn
(imported as CSS module)ds-btn-md
- should this styling just be part ofds-btn
? My feeling is yes: If a consumer wants to create a "variation" of the default ormd
, they can easily extend with their own class names, rather than needing to add multiple styling props to every element..ds-btn:disabled)
instead ofds-btn--disabled
).Decrease amount of class names for each component:
.ds-table > thead > tr > th
to ensure we only style the current table, and not all childth
elements regardless of nesting level.styles['table--zebra']
), but underscore is okay (styles.table__expander
).Decrease amount of DOM:
<Paragraph asChild>
as extensively as we do now, and rather ensure this styling is part of the CSS instead. With good use of font-tokens, this can be advantageous as each CSS file is a more concrete listing of all applied properties, but also increases file size a tiny bit.AvoidOUTDATED, SEE COMMENTdisplay: flex
display: flex
ordisplay: inline-flex
around text elements. This makes it easy to addgap
, but can have unwanted side effects if adding textual child elements, asflex
causes gap and block rendering for all all child elements, example:..will cause rendering:
⭐️ Text is *special*
display: flex
and rather usedisplay: inline-block + vertical-align
andmargin-left
ormargin-right
based on:first-child
or:last-child
. This is a bit more CSS, but makes the implementation more robust.<Button><Star /> <span>Text is <em>special</em></span></Button>
. I would not recommend this.Avoid
position: relative
et.al.position: relative
without any obvious reason or comment about why. - Suggested implementation: We should avoid causing new stacking contexts whenever possible for a predictable styling environment, and comment/document places whereposition
(or other stacking context properties) are used.Use
::before
or::after
withmask: url(svg)
for component graphicsAccordion
, example:::before
or::after
elements.Direct styling of input elements
ds-input
, and rather separate out the wrapper styling (if needed) as a own classds-form-field
so it is more modular/composable, works more closely with HTML-element names, and so that the wrapper can be re-used forSelect
,Datepicker
,Combobox
,Textarea
,Textfield
, or even custom form controls our consumers create. If prefix/suffix is needed, this can be an optional wrapper-element - just like the Danish Designsystem is solving it: https://designsystem.dk/komponenter/inputfelter/Spacing as responsibility of parent element
Tasks
Conversion to this format have been done on:
Create a PR with changes and just use non keyword to link to this issue #2295.
Components
The text was updated successfully, but these errors were encountered: