@julseb-lib/react 0.0.28 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +917 -910
- package/dist/index.es.js +2620 -2596
- package/dist/index.umd.js +273 -266
- package/dist/lib/components/Avatar/AvatarFunction.tsx +17 -2
- package/dist/lib/components/Avatar/styles.tsx +30 -3
- package/dist/lib/components/Avatar/types.ts +3 -0
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import { Image } from "../../"
|
|
|
7
7
|
import { appendStyles } from "../../lib-utils"
|
|
8
8
|
import { LibIcon } from "../LibIcon"
|
|
9
9
|
import type { LibComponentBase } from "../../types"
|
|
10
|
-
import { StyledAvatar } from "./styles"
|
|
10
|
+
import { StyledAvatar, StyledFallback } from "./styles"
|
|
11
11
|
import type { ILibAvatar } from "./types"
|
|
12
12
|
|
|
13
13
|
export const AvatarFunction = forwardRef<
|
|
@@ -98,7 +98,22 @@ export const AvatarFunction = forwardRef<
|
|
|
98
98
|
: undefined
|
|
99
99
|
}
|
|
100
100
|
fallback={
|
|
101
|
-
typeof img === "object" ?
|
|
101
|
+
typeof img === "object" ? (
|
|
102
|
+
// @ts-ignore
|
|
103
|
+
<StyledFallback
|
|
104
|
+
$backgroundColor={
|
|
105
|
+
img.fallbackBackgroundColor ??
|
|
106
|
+
backgroundColor
|
|
107
|
+
}
|
|
108
|
+
$fontColor={
|
|
109
|
+
img.fallbackFontColor ?? contentColor
|
|
110
|
+
}
|
|
111
|
+
$size={size}
|
|
112
|
+
$fontSize={img.fallbackFontSize ?? fontSize}
|
|
113
|
+
>
|
|
114
|
+
{img.fallback}
|
|
115
|
+
</StyledFallback>
|
|
116
|
+
) : undefined
|
|
102
117
|
}
|
|
103
118
|
/>
|
|
104
119
|
)}
|
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import type { FC } from "react"
|
|
4
4
|
import styled, { css } from "styled-components"
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
setDefaultTheme,
|
|
7
|
+
Badge,
|
|
8
|
+
Mixins,
|
|
9
|
+
FONT_WEIGHTS,
|
|
10
|
+
SPACERS,
|
|
11
|
+
stringifyPx,
|
|
12
|
+
} from "../../"
|
|
6
13
|
import type {
|
|
7
14
|
LibAllColors,
|
|
8
15
|
ILibBorder,
|
|
@@ -85,6 +92,26 @@ const StyledBadge = styled(Badge)<{
|
|
|
85
92
|
}
|
|
86
93
|
` as FC<any>
|
|
87
94
|
|
|
88
|
-
|
|
95
|
+
const StyledFallback = styled.span<{
|
|
96
|
+
$size: number
|
|
97
|
+
$backgroundColor: LibAllColors
|
|
98
|
+
$fontColor: LibAllColors
|
|
99
|
+
$fontSize: LibFontSizes
|
|
100
|
+
}>`
|
|
101
|
+
width: ${({ $size }) => stringifyPx($size)};
|
|
102
|
+
height: ${({ $size }) => stringifyPx($size)};
|
|
103
|
+
font-weight: ${FONT_WEIGHTS.BLACK};
|
|
104
|
+
background-color: ${({ $backgroundColor, theme }) =>
|
|
105
|
+
Mixins.AllColors($backgroundColor, theme)};
|
|
106
|
+
color: ${({ $fontColor, theme }) => Mixins.AllColors($fontColor, theme)};
|
|
107
|
+
font-size: ${({ $fontSize }) => Mixins.FontSize($fontSize)};
|
|
108
|
+
`
|
|
109
|
+
|
|
110
|
+
setDefaultTheme([
|
|
111
|
+
StyledAvatarContainer,
|
|
112
|
+
StyledAvatar,
|
|
113
|
+
StyledBadge,
|
|
114
|
+
StyledFallback,
|
|
115
|
+
])
|
|
89
116
|
|
|
90
|
-
export { StyledAvatarContainer, StyledAvatar, StyledBadge }
|
|
117
|
+
export { StyledAvatarContainer, StyledAvatar, StyledBadge, StyledFallback }
|