Skip to content

Commit

Permalink
🏷️ Label: change "meta" field type to ReactNode (#3341)
Browse files Browse the repository at this point in the history
* 🏷️ Label: change "meta" field type to ReactNode

* update snapshots
  • Loading branch information
oddvernes authored Mar 12, 2024
1 parent ca0f4da commit bd0a838
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export type AutocompleteProps<T> = {
/** Variants */
variant?: Variants
/** Meta text, for instance unit */
meta?: string
meta?: ReactNode
/** Disabled state
* @default false
*/
Expand Down
3 changes: 2 additions & 1 deletion packages/eds-core-react/src/components/Label/Label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type LabelBaseType = {
const LabelBase = styled.label<LabelBaseType>`
display: flex;
justify-content: space-between;
align-items: flex-end;
position: relative;
${typographyTemplate(tokens.typography)}
margin-left: ${tokens.spacings.left};
Expand All @@ -26,7 +27,7 @@ const Text = styled.span`

export type LabelProps = {
label: ReactNode
meta?: string
meta?: ReactNode
disabled?: boolean
} & LabelHTMLAttributes<HTMLLabelElement>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ exports[`Label Matches snapshot 1`] = `
.c0 {
display: flex;
justify-content: space-between;
align-items: flex-end;
position: relative;
margin: 0;
color: var(--eds_text__static_icons__tertiary, rgba(111, 111, 111, 1));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { forwardRef, SelectHTMLAttributes } from 'react'
import { forwardRef, SelectHTMLAttributes, ReactNode } from 'react'
import styled, { css, ThemeProvider } from 'styled-components'
import { Label } from '../Label'
import { nativeselect as tokens } from './NativeSelect.tokens'
Expand Down Expand Up @@ -73,7 +73,7 @@ export type NativeSelectProps = {
/** Label for the select element */
label: string
/** Meta text, for instance unit */
meta?: string
meta?: ReactNode
/** Disabled state */
disabled?: boolean
/** The user can choose multiple items */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ exports[`NativeSelect Matches snapshot 1`] = `
.c1 {
display: flex;
justify-content: space-between;
align-items: flex-end;
position: relative;
margin: 0;
color: var(--eds_text__static_icons__tertiary, rgba(111, 111, 111, 1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type SharedTextFieldProps = {
/** Label text */
label?: ReactNode
/** Meta text */
meta?: string
meta?: ReactNode
/** Unit text */
unit?: string
/** Helper text */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ exports[`TextField Matches snapshot 1`] = `
.c0 {
display: flex;
justify-content: space-between;
align-items: flex-end;
position: relative;
margin: 0;
color: var(--eds_text__static_icons__tertiary, rgba(111, 111, 111, 1));
Expand Down

0 comments on commit bd0a838

Please sign in to comment.