Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate with-atlaskit #11269

Merged
merged 8 commits into from
Apr 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/with-atlaskit/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["next/babel"],
"plugins": [["styled-components", { "ssr": true }]]
}
13 changes: 13 additions & 0 deletions examples/with-atlaskit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Atlassian Atlaskit example

This example shows how to use Next.js along with Atlaskit of React. This is intended to show the integration of this UI toolkit with the Framework.

Install it and run:

```bash
npm install
npm run dev
# or
yarn
yarn dev
```
30 changes: 30 additions & 0 deletions examples/with-atlaskit/components/ButtonComponent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react'
import Button, { ButtonGroup } from '@atlaskit/button'

export default () => {
return (
<React.Fragment>
<Button style={{ margin: 10 }}>Button</Button>
<Button style={{ margin: 10 }} appearance="primary">
Primary Button
</Button>
<Button style={{ margin: 10 }} appearance="danger">
Danger Button
</Button>
<Button style={{ margin: 10 }} appearance="warning">
Warning Button
</Button>
<Button style={{ margin: 10 }} appearance="link">
Link Button
</Button>
<Button style={{ margin: 10 }} isDisabled>
Disabled Button
</Button>
<ButtonGroup appearance="primary">
<Button>First Button</Button>
<Button>Second Button</Button>
<Button>Third Button</Button>
</ButtonGroup>
</React.Fragment>
)
}
30 changes: 30 additions & 0 deletions examples/with-atlaskit/components/CheckboxComponent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react'
import { Checkbox } from '@atlaskit/checkbox'

export default () => {
return (
<React.Fragment>
<Checkbox
value="Basic checkbox"
label="Basic checkbox"
onChange={() => {}}
name="checkbox-basic"
testId="cb-basic"
/>
<Checkbox
isDisabled
label="Disabled"
value="Disabled"
name="checkbox-disabled"
testId="cb-disabled"
/>
<Checkbox
isInvalid
label="Invalid"
value="Invalid"
name="checkbox-invalid"
testId="cb-invalid"
/>
</React.Fragment>
)
}
24 changes: 24 additions & 0 deletions examples/with-atlaskit/components/DateTimePickerComponent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react'
import {
DatePicker,
DateTimePicker,
TimePicker,
} from '@atlaskit/datetime-picker'
import { Label } from '@atlaskit/field-base'

export default () => {
return (
<React.Fragment>
<Label label="TimePicker - timeFormat (h:mm a)" />
<TimePicker onChange={console.log} timeFormat="h:mm a" />
<Label label="DatePicker - dateFormat (DD/MM/YYYY)" />
<DatePicker onChange={console.log} dateFormat="DD/MM/YYYY" />
<Label label="DateTimePicker - dateFormat (HH:mm) & timeFormat (Do MMMM YYYY)" />
<DateTimePicker
onChange={console.log}
timeFormat="HH:mm"
dateFormat="Do MMMM YYYY"
/>
</React.Fragment>
)
}
26 changes: 26 additions & 0 deletions examples/with-atlaskit/components/DropdownMenuComponent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react'
import DropdownMenu, {
DropdownItemGroup,
DropdownItem,
} from '@atlaskit/dropdown-menu'
import { Label } from '@atlaskit/field-base'

export default () => {
return (
<React.Fragment>
<Label label="DropdownMenu" />
<DropdownMenu trigger="Cities in Australia" triggerType="button">
<DropdownItemGroup>
<DropdownItem>Sydney</DropdownItem>
<DropdownItem>Melbourne</DropdownItem>
<DropdownItem>Adelaide</DropdownItem>
<DropdownItem>Perth</DropdownItem>
<DropdownItem>Brisbane</DropdownItem>
<DropdownItem>Canberra</DropdownItem>
<DropdownItem>Hobart</DropdownItem>
<DropdownItem>Darwin</DropdownItem>
</DropdownItemGroup>
</DropdownMenu>
</React.Fragment>
)
}
24 changes: 24 additions & 0 deletions examples/with-atlaskit/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "with-atlaskit",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"@atlaskit/button": "^13.3.9",
"@atlaskit/checkbox": "^10.1.10",
"@atlaskit/datetime-picker": "^9.2.8",
"@atlaskit/dropdown-menu": "^9.0.2",
"@atlaskit/field-base": "^14.0.2",
"next": "^9.3.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"styled-components": "^5.0.1"
},
"devDependencies": {
"babel-plugin-styled-components": "^1.10.7"
}
}
29 changes: 29 additions & 0 deletions examples/with-atlaskit/pages/_document.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Document from 'next/document'
import { ServerStyleSheet } from 'styled-components'

export default class MyDocument extends Document {
static async getInitialProps(ctx) {
const sheet = new ServerStyleSheet()
const originalRenderPage = ctx.renderPage

try {
ctx.renderPage = () =>
originalRenderPage({
enhanceApp: App => props => sheet.collectStyles(<App {...props} />),
})

const initialProps = await Document.getInitialProps(ctx)
return {
...initialProps,
styles: (
<>
{initialProps.styles}
{sheet.getStyleElement()}
</>
),
}
} finally {
sheet.seal()
}
}
}
16 changes: 16 additions & 0 deletions examples/with-atlaskit/pages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'
import ButtonComponent from '../components/ButtonComponent'
import CheckboxComponent from '../components/CheckboxComponent'
import DateTimePickerComponent from '../components/DateTimePickerComponent'
import DropdownMenuComponent from '../components/DropdownMenuComponent'

export default () => {
return (
<React.Fragment>
<ButtonComponent />
<CheckboxComponent />
<DateTimePickerComponent />
<DropdownMenuComponent />
</React.Fragment>
)
}