-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from datopian/setup-code-formatter
[Setup][s]- Setup Prettier as Code Formatter
- Loading branch information
Showing
35 changed files
with
1,041 additions
and
631 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"presets": ["next/babel"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
node_modules/ | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
.next/ | ||
/out/ | ||
|
||
# yarn | ||
yarn-error.log | ||
yarn.lock | ||
|
||
# sass | ||
.sass-cache | ||
|
||
# misc | ||
sandbox/* | ||
.env | ||
.staging.env | ||
.nyc_output/* | ||
.DS_Store | ||
|
||
public/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import React from 'react' | ||
import { render } from '@testing-library/react' | ||
import renderer from 'react-test-renderer' | ||
import Item from '../../../components/search/Item' | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import renderer from 'react-test-renderer'; | ||
import Item from '../../../components/search/Item'; | ||
|
||
test('📸 of Item component', () => { | ||
test('📸 of Item component', () => { | ||
const datapackage = { | ||
name: 'test', | ||
title: 'Title', | ||
description: 'A description.', | ||
organization: { | ||
title: 'test org', | ||
name: 'test-org' | ||
} | ||
} | ||
const tree = renderer.create(<Item datapackage={datapackage} />).toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
name: 'test-org', | ||
}, | ||
}; | ||
const tree = renderer.create(<Item datapackage={datapackage} />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import React from 'react' | ||
import { render } from '@testing-library/react' | ||
import renderer from 'react-test-renderer' | ||
import Total from '../../../components/search/Total' | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import renderer from 'react-test-renderer'; | ||
import Total from '../../../components/search/Total'; | ||
|
||
test('📸 of Total component', () => { | ||
const tree = renderer.create(<Total total={2} />).toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
test('📸 of Total component', () => { | ||
const tree = renderer.create(<Total total={2} />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
import React from 'react' | ||
import { render } from '@testing-library/react' | ||
import renderer from 'react-test-renderer' | ||
import Index from '../../pages/index' | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import renderer from 'react-test-renderer'; | ||
import Index from '../../pages/index'; | ||
|
||
test('📸 of Home page', () => { | ||
const tree = renderer.create(<Index />).toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
test('📸 of Home page', () => { | ||
const tree = renderer.create(<Index />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
test('renders text from hero section', () => { | ||
const { getByText } = render(<Index />) | ||
const linkElement = getByText( | ||
/Find, Share and Publish/ | ||
) | ||
expect(linkElement).toBeInTheDocument() | ||
}) | ||
const { getByText } = render(<Index />); | ||
const linkElement = getByText(/Find, Share and Publish/); | ||
expect(linkElement).toBeInTheDocument(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
import Link from 'next/link' | ||
import Link from 'next/link'; | ||
|
||
export default function Org({ org }) { | ||
return ( | ||
<> | ||
{org | ||
? <> | ||
<img src={org.image_url || 'https://datahub.io/static/img/datahub-cube-edited.svg'} className="h-5 w-5 mr-2 inline-block" /> | ||
{org ? ( | ||
<> | ||
<img | ||
src={ | ||
org.image_url || | ||
'https://datahub.io/static/img/datahub-cube-edited.svg' | ||
} | ||
className="h-5 w-5 mr-2 inline-block" | ||
/> | ||
<Link href={`/@${org.name}`}> | ||
<a className="font-semibold text-primary underline">{ org.title || org.name }</a> | ||
<a className="font-semibold text-primary underline"> | ||
{org.title || org.name} | ||
</a> | ||
</Link> | ||
</> | ||
: '' | ||
} | ||
) : ( | ||
'' | ||
)} | ||
</> | ||
) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,54 @@ | ||
import Link from 'next/link' | ||
import React, { useState } from 'react' | ||
import Link from 'next/link'; | ||
import React, { useState } from 'react'; | ||
|
||
export default function Nav() { | ||
const [open, setOpen] = useState(false) | ||
const [open, setOpen] = useState(false); | ||
|
||
const handleClick = (event) => { | ||
event.preventDefault() | ||
setOpen(!open) | ||
} | ||
event.preventDefault(); | ||
setOpen(!open); | ||
}; | ||
|
||
return ( | ||
<nav className="flex items-center justify-between flex-wrap bg-white p-4 border-b border-gray-200"> | ||
<div className="flex items-center flex-shrink-0 text-gray-700 mr-6"> | ||
<img src="/images/logo.svg" alt="portal logo" width="40" /> | ||
</div> | ||
<div className="block lg:hidden mx-4"> | ||
<button onClick={handleClick} className="flex items-center px-3 py-2 border rounded text-gray-700 border-orange-400 hover:text-black hover:border-black"> | ||
<svg className="fill-current h-3 w-3" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><title>Menu</title><path d="M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z"/></svg> | ||
<button | ||
onClick={handleClick} | ||
className="flex items-center px-3 py-2 border rounded text-gray-700 border-orange-400 hover:text-black hover:border-black" | ||
> | ||
<svg | ||
className="fill-current h-3 w-3" | ||
viewBox="0 0 20 20" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<title>Menu</title> | ||
<path d="M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z" /> | ||
</svg> | ||
</button> | ||
</div> | ||
<div className={`${open ? `block` : `hidden`} lg:block`}> | ||
<Link href="/search"> | ||
<Link href="/search"> | ||
<a className="block mt-4 lg:inline-block lg:mt-0 text-gray-700 hover:text-black mr-6"> | ||
Search | ||
</a> | ||
</Link> | ||
<Link href="http://tech.datopian.com/frontend/"> | ||
<a className="block mt-4 lg:inline-block lg:mt-0 text-gray-700 hover:text-black mr-6" target="_blank"> | ||
<a | ||
className="block mt-4 lg:inline-block lg:mt-0 text-gray-700 hover:text-black mr-6" | ||
target="_blank" | ||
> | ||
Docs | ||
</a> | ||
</Link> | ||
<Link href="https://github.com/datopian/portal"> | ||
<a className="inline-block text-sm px-4 py-2 leading-none border rounded text-white bg-black border-black hover:border-gray-700 hover:text-gray-700 hover:bg-white mt-4 lg:mt-0">GitHub</a> | ||
<a className="inline-block text-sm px-4 py-2 leading-none border rounded text-white bg-black border-black hover:border-gray-700 hover:text-gray-700 hover:bg-white mt-4 lg:mt-0"> | ||
GitHub | ||
</a> | ||
</Link> | ||
</div> | ||
</nav> | ||
) | ||
); | ||
} |
Oops, something went wrong.