forstok-ui-lib 5.0.1 → 5.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forstok-ui-lib",
3
- "version": "5.0.1",
3
+ "version": "5.0.3",
4
4
  "description": "Forstok UI Components Library",
5
5
  "path": "dist",
6
6
  "main": "dist/index.js",
@@ -24,6 +24,7 @@ const ButtonComponent = ({ children, $mode, $isIndicatorArrow=false, isIndicator
24
24
  ) : null;
25
25
  return (
26
26
  <ButtonContainer
27
+ {...$mode && { name: $mode }}
27
28
  $mode={$mode}
28
29
  $isIndicatorArrow={$isIndicatorArrow ? true : false}
29
30
  $isShown={$isShown ? true : false}
@@ -0,0 +1,17 @@
1
+ import type { ImgHTMLAttributes, ReactEventHandler } from 'react';
2
+ import ImagePlaceholder from '../../assets/images/image-placeholder.jpg';
3
+ import { ImageContainer } from './styles';
4
+
5
+ type TImage = ImgHTMLAttributes<HTMLImageElement> & {
6
+ $mode?: string
7
+ }
8
+
9
+ const ImageComponent = ({ $mode, ...props }: TImage) => {
10
+ const { width, height } = props;
11
+ const evError: ReactEventHandler<HTMLImageElement> = e => {
12
+ (e.target as HTMLImageElement).src = ImagePlaceholder;
13
+ }
14
+ return <ImageContainer $mode={$mode} width={width} height={height} onError={evError} {...props} />;
15
+ }
16
+
17
+ export default ImageComponent;
@@ -0,0 +1,39 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ const storeStyles = css `
4
+ width: 32px;
5
+ height: 32px;
6
+ `
7
+ const productStyles = css`
8
+ background-color: var(--mt-clr-bg);
9
+ `
10
+
11
+ const getImageModifiedStyled = ({ $mode, width, height }: { $mode?: string, width?: string|number, height?: string|number }) => {
12
+ let style = ''
13
+ if ($mode === 'store') {
14
+ style += storeStyles
15
+ } else if ($mode === 'product') {
16
+ style += productStyles
17
+ }
18
+ if (width && height) {
19
+ style += `
20
+ width:${width};
21
+ height:${height};
22
+ `
23
+ } else if (width) {
24
+ style += `
25
+ width:${width};
26
+ height:${width};
27
+ `
28
+ } else if (height) {
29
+ style += `
30
+ width:${width};
31
+ height:${height};
32
+ `
33
+ }
34
+ return style
35
+ }
36
+
37
+ export const ImageContainer = styled.img<{ $mode?: string, width?: string|number, height?: string|number }>`
38
+ ${getImageModifiedStyled}
39
+ `
@@ -11,6 +11,7 @@ export { default as MessageComponent } from './message';
11
11
  export { default as MessageQuestionComponent } from './message/question';
12
12
  export { default as PopupComponent } from './popup';
13
13
  export { default as ReactPortalComponent } from './portal';
14
+ export { default as ImageComponent } from './image';
14
15
 
15
16
  export * from './dropdown/typed';
16
17
  export * from './message/typed';
@@ -102,13 +102,13 @@ const getPopupHeaderWrapperModifiedStyled = ({ $width, $mode, $isOpen }:Pick<TPo
102
102
  position: fixed;
103
103
  z-index: 10;
104
104
  border-bottom: 1px solid var(--sec-clr-ln);
105
- button[mode=round-close] {
105
+ button[name=round-close] {
106
106
  position: absolute;
107
107
  top: 12px;
108
108
  right: 0px;
109
109
  }
110
110
  @media only screen and (min-width: 768px) {
111
- button[mode=round-close] {
111
+ button[name=round-close] {
112
112
  top: 16px;
113
113
  right: 20px;
114
114
  }
package/tsconfig.json CHANGED
@@ -22,8 +22,7 @@
22
22
  },
23
23
  "include": [
24
24
  "src",
25
- "src/declarations.d.ts"
26
- ],
25
+ "src/declarations.d.ts" ],
27
26
  "exclude": [
28
27
  "node_modules",
29
28
  "dist"