Skip to content

Commit e43cc8d

Browse files
authored
Add absolute paths imports (#96)
* Add absolute paths imports * Fix tests
1 parent 6883251 commit e43cc8d

File tree

109 files changed

+646
-553
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+646
-553
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@
9696
},
9797
"jest": {
9898
"moduleNameMapper": {
99-
"\\.(svg|jpg|png|css)$": "<rootDir>/empty-module.js"
99+
"\\.(svg|jpg|png|css)$": "<rootDir>/empty-module.js",
100+
"~(.*)$": "<rootDir>/src/$1"
100101
},
101102
"moduleFileExtensions": [
102103
"js",

src/components/CodePanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React, { memo, useState, useEffect } from 'react'
22
import Highlight, { defaultProps } from 'prism-react-renderer'
33
import { Box, Button, useClipboard } from '@chakra-ui/core'
4-
import { generateCode } from '../utils/code'
4+
import { generateCode } from '~utils/code'
55
import theme from 'prism-react-renderer/themes/nightOwl'
66
import { useSelector } from 'react-redux'
7-
import { getComponents } from '../core/selectors/components'
7+
import { getComponents } from '~core/selectors/components'
88

99
const CodePanel = () => {
1010
const components = useSelector(getComponents)

src/components/Header.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ import {
2222
} from '@chakra-ui/core'
2323
import { DiGithubBadge } from 'react-icons/di'
2424
import { AiFillThunderbolt } from 'react-icons/ai'
25-
import { buildParameters } from '../utils/codesandbox'
26-
import { generateCode } from '../utils/code'
27-
import useDispatch from '../hooks/useDispatch'
25+
import { buildParameters } from '~utils/codesandbox'
26+
import { generateCode } from '~utils/code'
27+
import useDispatch from '~hooks/useDispatch'
2828
import { useSelector } from 'react-redux'
29-
import { getComponents } from '../core/selectors/components'
30-
import { getShowLayout, getShowCode } from '../core/selectors/app'
31-
import HeaderMenu from './headerMenu/HeaderMenu'
29+
import { getComponents } from '~core/selectors/components'
30+
import { getShowLayout, getShowCode } from '~core/selectors/app'
31+
import HeaderMenu from '~components/headerMenu/HeaderMenu'
3232

3333
const CodeSandboxButton = () => {
3434
const components = useSelector(getComponents)

src/components/Metadata.tsx

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import React from 'react'
2+
import Head from 'next/head'
3+
4+
const Metadata = () => {
5+
return (
6+
<Head>
7+
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<meta name="theme-color" content="#000000" />
9+
<meta name="description" content="Visual editor for Chakra UI " />
10+
<link
11+
rel="apple-touch-icon"
12+
sizes="180x180"
13+
href="/apple-touch-icon.png"
14+
/>
15+
<link
16+
rel="icon"
17+
type="image/png"
18+
sizes="32x32"
19+
href="/favicon-32x32.png"
20+
/>
21+
<link
22+
rel="icon"
23+
type="image/png"
24+
sizes="16x16"
25+
href="/favicon-16x16.png"
26+
/>
27+
<link rel="manifest" href="/site.webmanifest" />
28+
<meta name="msapplication-TileColor" content="#da532c" />
29+
<meta name="theme-color" content="#ffffff" />
30+
31+
<title>OpenChakra</title>
32+
<meta
33+
name="description"
34+
content="React JSX visual editor for Chakra UI"
35+
/>
36+
<meta
37+
name="image"
38+
content="https://openchakra.app/images/og-graph-color.png"
39+
/>
40+
41+
{/* OpenGraph tags */}
42+
<meta property="og:url" content="https://openchakra.app" />
43+
<meta property="og:site_name" content="OpenChakra" />
44+
<meta property="og:type" content="website" />
45+
<meta property="og:title" content="OpenChakra" />
46+
<meta
47+
property="og:description"
48+
content="OpenChakra is a visual editor for React based on Chakra UI"
49+
/>
50+
<meta
51+
property="og:image"
52+
name="twitter:image"
53+
content="https://openchakra.app/images/og-graph-color.png"
54+
/>
55+
<meta property="og:image:width" content="1200" />
56+
<meta property="og:image:height" content="600" />
57+
58+
{/* Twitter Card tags */}
59+
<meta name="twitter:card" content="summary_large_image" />
60+
<meta name="twitter:title" content="OpenChakra" />
61+
<meta
62+
name="twitter:description"
63+
content="OpenChakra is a visual editor for React based on Chakra UI"
64+
/>
65+
<meta
66+
name="twitter:image"
67+
content="https://openchakra.app/images/og-graph-color.png"
68+
/>
69+
70+
<meta property="og:title" content="OpenChakra" />
71+
<meta
72+
property="og:description"
73+
content="OpenChakra is a visual editor for React based on Chakra UI"
74+
/>
75+
<meta property="og:type" content="website" />
76+
<meta property="og:url" content="https://openchakra.app" />
77+
<meta
78+
property="og:image:url"
79+
content="https://openchakra.app/images/og-graph-color.png"
80+
/>
81+
</Head>
82+
)
83+
}
84+
85+
export default Metadata

src/components/editor/ComponentPreview.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Backend from 'react-dnd-html5-backend'
77
import { ThemeProvider, theme } from '@chakra-ui/core'
88

99
import ComponentPreview from './ComponentPreview'
10-
import { storeConfig } from '../../core/store'
10+
import { storeConfig } from '~core/store'
1111

1212
function renderWithRedux(
1313
components: React.ReactNode,

src/components/editor/ComponentPreview.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
import React, { memo } from 'react'
22
import { useSelector } from 'react-redux'
33

4-
import AlertPreview from './previews/AlertPreview'
4+
import AlertPreview from '~components/editor/previews/AlertPreview'
55
import AvatarPreview, {
66
AvatarBadgePreview,
77
AvatarGroupPreview,
8-
} from './previews/AvatarPreview'
8+
} from '~components/editor/previews/AvatarPreview'
99
import AccordionPreview, {
1010
AccordionHeaderPreview,
1111
AccordionItemPreview,
1212
AccordionPanelPreview,
13-
} from './previews/AccordionPreview'
13+
} from '~components/editor/previews/AccordionPreview'
1414
import * as Chakra from '@chakra-ui/core'
15-
import WithChildrenPreviewContainer from './WithChildrenPreviewContainer'
16-
import { getComponentBy } from '../../core/selectors/components'
17-
import PreviewContainer from './PreviewContainer'
18-
import { InputRightElementPreview } from './previews/InputRightElement'
19-
import { InputLeftElementPreview } from './previews/InputLeftElement'
20-
import AspectRatioBoxPreview from './previews/AspectRatioBoxPreview'
15+
import { getComponentBy } from '~core/selectors/components'
16+
import { InputRightElementPreview } from '~components/editor/previews/InputRightElement'
17+
import { InputLeftElementPreview } from '~components/editor/previews/InputLeftElement'
18+
import AspectRatioBoxPreview from '~components/editor/previews/AspectRatioBoxPreview'
19+
import PreviewContainer from '~components/editor/PreviewContainer'
20+
import WithChildrenPreviewContainer from '~components/editor/WithChildrenPreviewContainer'
2121

2222
const ComponentPreview: React.FC<{
2323
componentName: string

src/components/editor/Editor.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React, { memo } from 'react'
22
import { Box, Text, Link } from '@chakra-ui/core'
3-
import ComponentPreview from './ComponentPreview'
4-
import { useDropComponent } from '../../hooks/useDropComponent'
3+
import { useDropComponent } from '~hooks/useDropComponent'
54
import SplitPane from 'react-split-pane'
6-
import CodePanel from '../CodePanel'
5+
import CodePanel from '~components/CodePanel'
76
import { useSelector } from 'react-redux'
8-
import useDispatch from '../../hooks/useDispatch'
9-
import { getComponents } from '../../core/selectors/components'
10-
import { getShowLayout, getShowCode } from '../../core/selectors/app'
7+
import useDispatch from '~hooks/useDispatch'
8+
import { getComponents } from '~core/selectors/components'
9+
import { getShowLayout, getShowCode } from '~core/selectors/app'
10+
import ComponentPreview from '~components/editor/ComponentPreview'
1111

1212
export const gridStyles = {
1313
backgroundImage:

src/components/editor/PreviewContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { FunctionComponent, ComponentClass } from 'react'
2-
import { useInteractive } from '../../hooks/useInteractive'
2+
import { useInteractive } from '~hooks/useInteractive'
33
import { Box } from '@chakra-ui/core'
44

55
const PreviewContainer: React.FC<{

src/components/editor/WithChildrenPreviewContainer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { FunctionComponent, ComponentClass } from 'react'
2-
import { useInteractive } from '../../hooks/useInteractive'
3-
import { useDropComponent } from '../../hooks/useDropComponent'
4-
import ComponentPreview from './ComponentPreview'
2+
import { useInteractive } from '~hooks/useInteractive'
3+
import { useDropComponent } from '~hooks/useDropComponent'
4+
import ComponentPreview from '~components/editor/ComponentPreview'
55
import { Box } from '@chakra-ui/core'
66

77
const WithChildrenPreviewContainer: React.FC<{

src/components/editor/previews/AccordionPreview.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import React from 'react'
2-
import { useInteractive } from '../../../hooks/useInteractive'
3-
import { useDropComponent } from '../../../hooks/useDropComponent'
2+
import { useInteractive } from '~hooks/useInteractive'
3+
import { useDropComponent } from '~hooks/useDropComponent'
44
import {
55
Box,
66
Accordion,
77
AccordionHeader,
88
AccordionItem,
99
AccordionPanel,
1010
} from '@chakra-ui/core'
11-
import ComponentPreview from '../ComponentPreview'
12-
import { AccordionWhitelist } from '../../../utils/editor'
11+
import ComponentPreview from '~components/editor/ComponentPreview'
12+
import { AccordionWhitelist } from '~utils/editor'
1313

1414
const acceptedTypes: ComponentType[] = ['AccordionItem']
1515

0 commit comments

Comments
 (0)