@autobusal/common 0.0.8 → 0.0.9

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.
@@ -0,0 +1,56 @@
1
+ import { SpinnerRoundFilled, SpinnerCircularFixed } from 'spinners-react';
2
+ import { useSystemTheme } from '@autobusal/providers';
3
+ import Skeleton from 'react-loading-skeleton';
4
+ import { ContainerGeneral
5
+ // , ContainerInline
6
+ , ContainerParagraph } from './styles';
7
+ import 'react-loading-skeleton/dist/skeleton.css';
8
+
9
+ export const General = (): JSX.Element => {
10
+ const theme = useSystemTheme();
11
+
12
+ const options = {
13
+ speed: 75,
14
+ thickness: 120,
15
+ color: (theme === 'light' ? '#CECECE' : '#F2F2F2'),
16
+ size: '40px'
17
+ };
18
+
19
+ return (
20
+ <ContainerGeneral>
21
+ { import.meta.env.VITE_APP_TYPE === 'normal'
22
+ ? <SpinnerRoundFilled size={ options.size } color={ options.color } speed={ options.speed } thickness={ options.thickness } />
23
+ : <SpinnerCircularFixed size={ options.size } color={ options.color } speed={ options.speed } thickness={ options.thickness } />
24
+ }
25
+ </ContainerGeneral>
26
+ )
27
+ };
28
+
29
+ // interface InlineProps {
30
+ // text: string
31
+ // }
32
+
33
+ // export const Inline = ({ text }: InlineProps): JSX.Element => (
34
+ // <ContainerInline>
35
+ // <SpinnerRoundFilled
36
+ // size="30px"
37
+ // color="#FBC02D"
38
+ // speed={ 75 }
39
+ // thickness={ 120 }
40
+ // />
41
+
42
+ // { text }
43
+ // </ContainerInline>
44
+ // );
45
+
46
+ interface ParagraphProps {
47
+ count?: number
48
+ }
49
+
50
+ export const Paragraph = ({ count = 3 }: ParagraphProps): JSX.Element => (
51
+ <ContainerParagraph>
52
+ <Skeleton count={ count - 1 } /> <br />
53
+ <Skeleton count={ count + 1 } /> <br />
54
+ <Skeleton count={ count } />
55
+ </ContainerParagraph>
56
+ );
@@ -0,0 +1,22 @@
1
+ import styled from 'styled-components';
2
+
3
+ export const ContainerGeneral = styled.div`
4
+ width: 100%;
5
+ height: 100%;
6
+ display: flex;
7
+ align-items: center;
8
+ justify-content: center;
9
+ `;
10
+
11
+ // export const ContainerInline = styled.div`
12
+ // display: flex;
13
+ // gap: 10px;
14
+ // align-items: center;
15
+ // justify-content: center;
16
+ // font-size: ${ props => props.theme.size.info };
17
+ // color: ${ props => props.theme.faded };
18
+ // `;
19
+
20
+ export const ContainerParagraph = styled.div`
21
+ padding: 15px 0;
22
+ `;
@@ -0,0 +1,37 @@
1
+ import { AiOutlineClose } from 'react-icons/ai';
2
+ import { useOverflow } from '@autobusal/hooks';
3
+ import { Paragraph } from '../index';
4
+ import { Background, Container, Title, ButtonClose } from './styles';
5
+
6
+ interface Props {
7
+ loading?: boolean
8
+ width: number
9
+ title: string
10
+ content: JSX.Element
11
+ onClose: () => void
12
+ }
13
+
14
+ const Modal = ({ loading, width, title, content, onClose }: Props): JSX.Element => {
15
+ // hide the scroll
16
+ useOverflow();
17
+
18
+ return (
19
+ <>
20
+ <Background />
21
+
22
+ <Container className="box" $width={ width }>
23
+ <Title>
24
+ <h1>{ title }</h1>
25
+
26
+ <ButtonClose type="button" onClick={ onClose }>
27
+ <AiOutlineClose />
28
+ </ButtonClose>
29
+ </Title>
30
+
31
+ { loading ? <Paragraph /> : content }
32
+ </Container>
33
+ </>
34
+ );
35
+ };
36
+
37
+ export default Modal;
@@ -0,0 +1,49 @@
1
+ import styled from 'styled-components';
2
+
3
+ export const Background = styled.div`
4
+ position: fixed;
5
+ top: 0;
6
+ left: 0;
7
+ z-index: 1002;
8
+ width: 100%;
9
+ height: 100%;
10
+ background-color: ${ props => props.theme.menu.transparent };
11
+ backdrop-filter: blur(25px);
12
+ -webkit-backdrop-filter: blur(25px);
13
+ `;
14
+
15
+ export const Container = styled.div<{ $width: number }>`
16
+ position: fixed;
17
+ top: 50%;
18
+ left: 50%;
19
+ z-index: 1003;
20
+ width: 90%;
21
+ max-width: ${ props => props.$width }px;
22
+ max-height: 80%;
23
+ overflow-y: auto;
24
+ padding: 15px;
25
+ text-align: left;
26
+ border-top: 4px solid $yellow;
27
+ transform: translate(-50%, -50%);
28
+ `;
29
+
30
+ export const Title = styled.div`
31
+ display: flex;
32
+ margin-bottom: 15px;
33
+
34
+ & > h1 {
35
+ margin: 0;
36
+ }
37
+ `;
38
+
39
+ export const ButtonClose = styled.button`
40
+ display: flex;
41
+ justify-content: center;
42
+ align-items: center;
43
+ width: 26px;
44
+ height: 26px;
45
+ margin-left: auto;
46
+ font-size: ${ props => props.theme.size.m };
47
+ background: ${ props => props.theme.primary.neutral };
48
+ border-radius: 100px;
49
+ `;
package/index.ts CHANGED
@@ -1,11 +1,14 @@
1
1
  import CookieNotification from './CookieNotification/CookieNotification';
2
2
  import ChangeLanguage from './ChangeLanguage/ChangeLanguage';
3
3
  import { Button } from './Button/Button';
4
+ import { General, Paragraph } from './Loading/Loading';
4
5
  import Meta from './Meta';
5
6
 
6
7
  export {
7
8
  Button,
8
9
  CookieNotification,
9
10
  ChangeLanguage,
10
- Meta
11
+ General,
12
+ Meta,
13
+ Paragraph
11
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/common",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "dependencies": {