oddsgate-ds 1.0.22 → 1.0.24

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": "oddsgate-ds",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "Miew theme component library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -15,25 +15,74 @@ const Counter = ({
15
15
  }: ICounter) => {
16
16
  if (!number) return <></>;
17
17
 
18
+ const savedCallback: any = useRef();
19
+ const targetRef = useRef<HTMLDivElement>()
18
20
  const [counterValue, setCounterValue] = useState<number>(0);
21
+ const [counterVisible, setCounterVisible] = useState<boolean>(false);
19
22
 
23
+ let timeout
20
24
  const speed = 50;
21
25
  const increment = Math.trunc(number / speed) < 1 ? 1 : Math.trunc(number / speed);
22
26
 
23
- useInterval(() => {
24
- if (counterValue != number) {
25
- if (counterValue > number) {
26
- setCounterValue(number)
27
+
28
+ useEffect(() => {
29
+ savedCallback.current = () => {
30
+ if (counterValue != number) {
31
+ if (counterValue > number) {
32
+ setCounterValue(number)
33
+ } else {
34
+ setCounterValue(counterValue + increment);
35
+ }
27
36
  } else {
28
- setCounterValue(counterValue + increment);
37
+ return true;
38
+ }
39
+ };
40
+ });
41
+
42
+ useEffect(() => {
43
+ function tick() {
44
+ if (savedCallback && savedCallback.current) {
45
+ const result = (savedCallback as unknown as any).current();
46
+ if (result === true) {// if callback returs true, clear timeout;
47
+ clearInterval(timeout);
48
+ }
29
49
  }
30
- } else {
31
- return true;
32
50
  }
33
- }, speed);
51
+
52
+ if (counterVisible) timeout = setInterval(tick, speed);
53
+
54
+ return () => clearInterval(timeout);
55
+ }, [counterVisible]);
56
+
57
+ useEffect(() => {
58
+ let observer = new IntersectionObserver((entries, observer) => {
59
+ entries.forEach((entry) => {
60
+ const element = targetRef.current;
61
+
62
+ if (!entry.target || !element) return;
63
+
64
+ if (entry.intersectionRatio > 0) {
65
+ setCounterVisible(true);
66
+ observer.unobserve(element);
67
+ }
68
+ });
69
+ }, {});
70
+
71
+ observer.observe(targetRef.current as any);
72
+
73
+ // Cleanup function to unobserve when the component unmounts
74
+ return () => {
75
+ if (targetRef.current) {
76
+ observer.unobserve(targetRef.current);
77
+ }
78
+ };
79
+ }, []);
80
+
81
+
34
82
 
35
83
  return (
36
84
  <StyledCounter
85
+ ref={targetRef as any}
37
86
  className={className}
38
87
  style={style}
39
88
  >
@@ -15,7 +15,11 @@ export default {
15
15
 
16
16
  export const Example: StoryObj<ICounter> = {
17
17
  render: args => (
18
- <Counter {...args}></Counter>
18
+ <>
19
+ <div style={{ height: "2000px" }}>
20
+ </div>
21
+ <Counter {...args}></Counter>
22
+ </>
19
23
  ),
20
24
  args: {
21
25
  title: "lorem ipsum",
@@ -1,7 +1,9 @@
1
1
  import { IDropdown, IDropdownContainer, IDropdownItem, IDropdownTitle } from './Dropdown.interface';
2
- import { colors, responsiveMedia, shadows } from '@/styles/variables';
2
+ import { colors, radius, responsiveMedia, shadows } from '@/styles/variables';
3
3
  import styled, { css } from 'styled-components';
4
4
 
5
+ import { fontSize } from '@/styles/utilities';
6
+
5
7
  export const StyledDropdown = styled.div<IDropdown>`
6
8
  position: relative;
7
9
  display: inline-flex;
@@ -10,12 +12,26 @@ export const StyledDropdown = styled.div<IDropdown>`
10
12
  export const StyledDropdownTitle = styled.div<IDropdownTitle>`
11
13
  display: flex;
12
14
  align-items: center;
15
+
16
+ color: ${colors.primary50};
17
+ background-color: ${colors.secondary50};
18
+
19
+ ${fontSize('h5')};
20
+ padding: 10px 20px;
21
+ border-radius: 50px;
22
+ text-transform:uppercase;
23
+
13
24
  transition: color 0.15s ease-in-out;
14
25
  cursor: pointer;
15
26
 
27
+ &:hover{
28
+ color: ${colors.secondary50};
29
+ background-color: ${colors.primary50};
30
+ }
31
+
16
32
  ${({ open }) => open && `
17
- color: ${colors.primary70} !important;
18
- user-select: none
33
+ color: ${colors.secondary50};
34
+ background-color: ${colors.primary50};
19
35
  `}
20
36
  `;
21
37
 
@@ -26,25 +42,28 @@ export const StyledDropdownContainer = styled.ul<IDropdownContainer>`
26
42
  left: 0;
27
43
 
28
44
  margin-top: 12px;
29
- padding-bottom: 12px;
30
- background: ${colors.white};
45
+ padding: 20px;
46
+ background: ${colors.secondary50};
31
47
  box-shadow: ${shadows.sm};
48
+ border-radius: ${radius.md};
49
+
50
+ min-width: 18rem;
32
51
 
33
52
  opacity: ${props => props.open ? 1 : 0};
34
53
  pointer-events: ${props => props.open ? "auto" : "none"};
35
54
 
55
+ transform: ${props => props.open ? "rotate(0deg) translateY(0)" : "rotate(8deg) translateY(30px)"}; ;
56
+
36
57
  z-index: 1;
37
- transition: opacity 0.15s ease-in-out;
58
+ transition: all 0.35s ease-in-out;
38
59
  `;
39
60
  export const StyledDropdownItem = styled.li<IDropdownItem>`
40
61
  display:flex;
41
- justify-content: space-between;
62
+ gap: 8px;
42
63
  align-items: center;
43
- width: 100%;
44
- padding: 8px 18px;
45
64
  cursor: pointer;
46
65
 
47
66
  &:hover {
48
- color: ${colors.primary70}
67
+ color: ${colors.primary50}
49
68
  }
50
69
  `;
@@ -33,11 +33,11 @@ const Cover = ({
33
33
  style={{ ...style, minHeight: minHeight || undefined }}
34
34
  >
35
35
  {imageElement}
36
- {overlayColor && overlayOpacity && (
36
+ {overlayColor && overlayOpacity ? (
37
37
  <StyledCoverOverlay
38
38
  style={{ backgroundColor: overlayColor, opacity: overlayOpacity }}
39
39
  ></StyledCoverOverlay>
40
- )}
40
+ ) : (<></>)}
41
41
  <StyledCoverContent>{children}</StyledCoverContent>
42
42
  </StyledCover>
43
43
  )
@@ -8,7 +8,6 @@ import {
8
8
 
9
9
  import Heading from '@/components/atoms/Heading/Heading.component'
10
10
  import { ITabs } from './Tabs.interface'
11
- import Icon from '@/components/atoms/Icon/Icon.component'
12
11
 
13
12
  const Tabs = ({ id, title, menu, vertical, className, style }: ITabs) => {
14
13
  const [active, setActive] = useState(0)
@@ -24,7 +24,7 @@ export const StyledTabsLinks = styled.a<ITabsItem>`
24
24
  width: 100%;
25
25
  color: ${colors.white};
26
26
  background-color: ${colors.third10};
27
- padding: 8px 12px;
27
+ padding: 8px 18px;
28
28
  border-radius: 50px;
29
29
  transition: all 0.3s linear;
30
30
  cursor: pointer;
@@ -32,6 +32,10 @@ export const StyledTabsLinks = styled.a<ITabsItem>`
32
32
  &:hover{
33
33
  background-color: ${colors.primary50};
34
34
  }
35
+
36
+ ${({ $active }) => $active && `
37
+ background-color: ${colors.primary50};
38
+ `}
35
39
  `
36
40
 
37
41
 
@@ -51,7 +55,7 @@ export const StyledTabs = styled.div<ITabs>`
51
55
  gap: 16px;
52
56
 
53
57
  ${({ vertical }) => vertical && `
54
- @media only screen and (max-width: ${responsiveMedia}) {
58
+ @media only screen and (min-width: ${responsiveMedia}) {
55
59
  flex-flow: row;
56
60
 
57
61
  & > div{
@@ -64,6 +68,11 @@ export const StyledTabs = styled.div<ITabs>`
64
68
  flex-shrink: 1;
65
69
  }
66
70
  }
71
+
72
+ ${StyledTabsMenu}{
73
+ flex-flow: column;
74
+ justify-content: flex-start;
75
+ }
67
76
  }
68
77
  `}
69
78
  `;
@@ -10,6 +10,7 @@ export const useInterval = (callback, delay) => {
10
10
 
11
11
  useEffect(() => {
12
12
  function tick() {
13
+ console.log("tou2");
13
14
  if (savedCallback && savedCallback.current) {
14
15
  const result = (savedCallback as unknown as any).current();
15
16
  if (result === true) {// if callback returs true, clear timeout;