Merged in fix/3697-prettier-configs (pull request #3396)
fix(SW-3691): Setup one prettier config for whole repo * Setup prettierrc in root and remove other configs Approved-by: Joakim Jäderberg Approved-by: Linus Flood
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
import { MaterialSymbol, type MaterialSymbolProps } from './MaterialSymbol'
|
||||
import { MaterialSymbol, type MaterialSymbolProps } from "./MaterialSymbol"
|
||||
|
||||
import { iconVariants } from '../variants'
|
||||
import { iconVariants } from "../variants"
|
||||
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
import { HTMLAttributes } from 'react'
|
||||
import { getIconAriaProps } from '../utils'
|
||||
import type { VariantProps } from "class-variance-authority"
|
||||
import { HTMLAttributes } from "react"
|
||||
import { getIconAriaProps } from "../utils"
|
||||
|
||||
export interface MaterialIconProps
|
||||
extends
|
||||
Pick<MaterialSymbolProps, 'size' | 'icon' | 'className' | 'style'>,
|
||||
Omit<HTMLAttributes<HTMLSpanElement>, 'color' | 'id'>,
|
||||
Pick<MaterialSymbolProps, "size" | "icon" | "className" | "style">,
|
||||
Omit<HTMLAttributes<HTMLSpanElement>, "color" | "id">,
|
||||
VariantProps<typeof iconVariants> {
|
||||
isFilled?: boolean
|
||||
}
|
||||
export type MaterialIconSetIconProps = Omit<MaterialIconProps, 'icon'>
|
||||
export type MaterialIconSetIconProps = Omit<MaterialIconProps, "icon">
|
||||
export function MaterialIcon({
|
||||
color,
|
||||
size = 24,
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
// since it doesn't support React 19 and is not maintained anymore.
|
||||
// We should probably move to a different solution in the future.
|
||||
|
||||
import type { ElementType, CSSProperties, ReactElement, Ref } from 'react'
|
||||
import type { ElementType, CSSProperties, ReactElement, Ref } from "react"
|
||||
import type {
|
||||
MaterialSymbolWeight,
|
||||
PolymorphicComponentProps,
|
||||
SymbolCodepoints,
|
||||
} from './types'
|
||||
import { cx } from 'class-variance-authority'
|
||||
export type { MaterialSymbolWeight, SymbolCodepoints } from './types'
|
||||
} from "./types"
|
||||
import { cx } from "class-variance-authority"
|
||||
export type { MaterialSymbolWeight, SymbolCodepoints } from "./types"
|
||||
|
||||
export type MaterialSymbolProps = {
|
||||
/** Required. The name of the icon to render. */
|
||||
@@ -29,7 +29,7 @@ export type MaterialSymbolProps = {
|
||||
/** Default `'inherit'`
|
||||
*
|
||||
* Color accepts key values (`'red'`, `'blue'`, `'indigo'`, etc.), `<hex-color>`, `<rgb()>`, `<hsl()>` and `<hwb()>` values. */
|
||||
color?: CSSProperties['color']
|
||||
color?: CSSProperties["color"]
|
||||
className?: string
|
||||
style?: CSSProperties
|
||||
}
|
||||
@@ -54,34 +54,34 @@ export const MaterialSymbol = (<C extends ElementType>(
|
||||
ref: Ref<C>
|
||||
): ReactElement => {
|
||||
const Component =
|
||||
onClick !== undefined ? 'button' : ((as as ElementType) ?? 'span')
|
||||
onClick !== undefined ? "button" : ((as as ElementType) ?? "span")
|
||||
const style = { color, ...propStyle }
|
||||
|
||||
if (fill)
|
||||
style.fontVariationSettings = [style.fontVariationSettings, '"FILL" 1']
|
||||
.filter(Boolean)
|
||||
.join(', ')
|
||||
.join(", ")
|
||||
if (weight)
|
||||
style.fontVariationSettings = [
|
||||
style.fontVariationSettings,
|
||||
`"wght" ${weight}`,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(', ')
|
||||
.join(", ")
|
||||
if (grade)
|
||||
style.fontVariationSettings = [
|
||||
style.fontVariationSettings,
|
||||
`"GRAD" ${grade}`,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(', ')
|
||||
.join(", ")
|
||||
if (size) {
|
||||
style.fontVariationSettings = [
|
||||
style.fontVariationSettings,
|
||||
`"opsz" ${size}`,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(', ')
|
||||
.join(", ")
|
||||
style.fontSize = size
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ export const MaterialSymbol = (<C extends ElementType>(
|
||||
ref={ref}
|
||||
style={style}
|
||||
onClick={onClick}
|
||||
className={cx('material-symbols', className)}
|
||||
className={cx("material-symbols", className)}
|
||||
>
|
||||
{icon}
|
||||
</Component>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1 +1 @@
|
||||
export { MaterialSymbol, type MaterialSymbolProps } from './MaterialSymbol'
|
||||
export { MaterialSymbol, type MaterialSymbolProps } from "./MaterialSymbol"
|
||||
|
||||
@@ -2,8 +2,8 @@ import type {
|
||||
JSXElementConstructor,
|
||||
ComponentPropsWithoutRef,
|
||||
JSX,
|
||||
} from 'react'
|
||||
import type { MaterialSymbolWeightArray, SymbolCodepointsArray } from './consts'
|
||||
} from "react"
|
||||
import type { MaterialSymbolWeightArray, SymbolCodepointsArray } from "./consts"
|
||||
|
||||
export type SymbolCodepoints = (typeof SymbolCodepointsArray)[number]
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@ export {
|
||||
MaterialIcon,
|
||||
type MaterialIconProps,
|
||||
type MaterialIconSetIconProps,
|
||||
} from './MaterialIcon'
|
||||
} from "./MaterialIcon"
|
||||
|
||||
Reference in New Issue
Block a user