@mirai/core 0.3.2 → 0.3.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": "@mirai/core",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "source": "src/index.js",
5
5
  "repository": "https://gitlab.com/miraicorp/dev/frontend/core",
6
6
  "author": "JΛVI <hello@soyjavi.com>",
@@ -2,10 +2,13 @@
2
2
  import { useStore } from '@mirai/data-sources';
3
3
  import { Action, Input, Text, View } from '@mirai/ui';
4
4
  import React from 'react';
5
+ import { useLocation } from 'wouter';
5
6
 
6
7
  import * as style from './App.module.css';
7
8
 
8
9
  export const Container = ({ children }) => {
10
+ const [, setLocation] = useLocation();
11
+
9
12
  const {
10
13
  value: { session },
11
14
  } = useStore();
@@ -22,21 +25,21 @@ export const Container = ({ children }) => {
22
25
 
23
26
  <View row className={[style.wrapper, style.main]}>
24
27
  <View row>
25
- <Action href="/">
28
+ <Action onPress={() => setLocation('/')}>
26
29
  <Text>Home</Text>
27
30
  </Action>
28
31
 
29
- <Action href="/about-us" className={style.hideMobile}>
32
+ <Action className={style.hideMobile} onPress={() => setLocation('/about-us')}>
30
33
  <Text>About Us</Text>
31
34
  </Action>
32
35
 
33
- <Action href="/rooms" className={style.hideMobile}>
36
+ <Action className={style.hideMobile} onPress={() => setLocation('/rooms')}>
34
37
  <Text>Our Rooms</Text>
35
38
  </Action>
36
39
  </View>
37
40
 
38
41
  <View>
39
- <Action inline href="/">
42
+ <Action inline onPress={() => setLocation('/')}>
40
43
  <Text bold headline level={1}>
41
44
  Monalisa
42
45
  </Text>
@@ -47,7 +50,7 @@ export const Container = ({ children }) => {
47
50
  <View row>
48
51
  <View data-mirai-component="session" />
49
52
  {!session && (
50
- <Action href="/signup" className={style.hideMobile}>
53
+ <Action className={style.hideMobile} onPress={() => setLocation('/signup')}>
51
54
  <Text>Signup</Text>
52
55
  </Action>
53
56
  )}
@@ -63,48 +66,48 @@ export const Container = ({ children }) => {
63
66
  <View row className={[style.wrapper, style.links]}>
64
67
  <View>
65
68
  <Text bold>Site map</Text>
66
- <Action href="/" inline small>
69
+ <Action inline small onPress={() => setLocation('/')}>
67
70
  Home
68
71
  </Action>
69
- <Action href="/signup" inline small>
72
+ <Action inline small onPress={() => setLocation('/signup')}>
70
73
  Signup
71
74
  </Action>
72
- <Action href="/profile" inline small>
75
+ <Action inline small onPress={() => setLocation('/profile')}>
73
76
  Profile
74
77
  </Action>
75
- <Action href="/deals" inline small>
78
+ <Action inline small onPress={() => setLocation('/deals')}>
76
79
  Deals
77
80
  </Action>
78
81
  </View>
79
82
 
80
83
  <View>
81
84
  <Text bold>Reservation</Text>
82
- <Action href="/step0-accommodations" inline small>
85
+ <Action inline small onPress={() => setLocation('/step0-accommodations')}>
83
86
  0. accommodations
84
87
  </Action>
85
- <Action href="/step1-rates" inline small>
88
+ <Action inline small onPress={() => setLocation('/step1-rates')}>
86
89
  1. rates
87
90
  </Action>
88
- <Action href="/step2-checkout" inline small>
91
+ <Action inline small onPress={() => setLocation('/step2-checkout')}>
89
92
  2. checkout
90
93
  </Action>
91
- <Action href="/step3-booking" inline small>
94
+ <Action inline small onPress={() => setLocation('/step3-booking')}>
92
95
  3. booking
93
96
  </Action>
94
97
  </View>
95
98
 
96
99
  <View>
97
100
  <Text bold>More</Text>
98
- <Action href="/legal-advice" inline small>
101
+ <Action inline small onPress={() => setLocation('/legal-advice')}>
99
102
  Legal Advice
100
103
  </Action>
101
- <Action href="/cookie-policy" inline small>
104
+ <Action inline small onPress={() => setLocation('/cookie-policy')}>
102
105
  Cookie Policy
103
106
  </Action>
104
- <Action href="/privacy-policy" inline small>
107
+ <Action inline small onPress={() => setLocation('/privacy-policy')}>
105
108
  Privacy Policy
106
109
  </Action>
107
- <Action href="/complaints-channel" inline small>
110
+ <Action inline small onPress={() => setLocation('/complaints-channel')}>
108
111
  Complaints Channel
109
112
  </Action>
110
113
  </View>
package/public/App.jsx CHANGED
@@ -1,12 +1,17 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import ReactDOM from 'react-dom';
3
- import { Route, Switch } from 'wouter';
3
+ import { useLocation, Route, Switch } from 'wouter';
4
4
 
5
5
  import { Container } from './App.Container';
6
6
  import { Deals, Home, NotFound, Profile, Signup, Step2, Step3 } from './routes';
7
7
 
8
8
  const App = () => {
9
- useEffect(() => window.Mirai?.core(), []);
9
+ const [location] = useLocation();
10
+
11
+ useEffect(() => {
12
+ window.Mirai?.core();
13
+ window.scrollTo({ behavior: 'smooth', top: 0 });
14
+ }, [location]);
10
15
 
11
16
  return (
12
17
  <Container>
@@ -1,18 +1,23 @@
1
- import { Action, Button, Text, View } from '@mirai/ui';
1
+ import { Button, Text, View } from '@mirai/ui';
2
2
  import React from 'react';
3
+ import { useLocation } from 'wouter';
3
4
 
4
5
  import * as style from './routes.module.css';
5
6
 
6
- export const NotFound = () => (
7
- <View tag="section" className={[style.section, style.highlight, style.home]}>
8
- <View className={[style.wrapper, style.centered]}>
9
- <Text bold className={style.slogan}>
10
- Oops! Something went wrong.
11
- </Text>
12
- <Text headline>Url {window.location.href} is not a valid.</Text>
13
- <Action href="/">
14
- <Button preventDefault={false}>RETURN TO HOME →</Button>
15
- </Action>
7
+ export const NotFound = () => {
8
+ const [, setLocation] = useLocation();
9
+
10
+ return (
11
+ <View tag="section" className={[style.section, style.highlight, style.home]}>
12
+ <View className={[style.wrapper, style.centered]}>
13
+ <Text bold className={style.slogan}>
14
+ Oops! Something went wrong.
15
+ </Text>
16
+ <Text headline>Url {window.location.href} is not a valid.</Text>
17
+ <Button preventDefault={false} onPress={() => setLocation('/')}>
18
+ RETURN TO HOME →
19
+ </Button>
20
+ </View>
16
21
  </View>
17
- </View>
18
- );
22
+ );
23
+ };