Skip to content
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
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<!--
BONUS POINTS: spin up and share an example via
https://codesandbox.io/s/43nwpkn717 or https://codesandbox.io/s/new or https://stackblitz.com/fork/react.
https://codesandbox.io/s/github/zendeskgarden/react-components/tree/master/examples/codesandbox/garden-create-react-app or https://codesandbox.io/s/new or https://stackblitz.com/fork/react.
-->

### Fine Print
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ render(<App />, document.getElementById('root'));

Try out Garden React components in a mock product environment.

[![Edit Garden Create-React-App](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/43nwpkn717)
[![Edit Garden Create-React-App](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/zendeskgarden/react-components/tree/master/examples/codesandbox/garden-create-react-app)

## Contribution

Expand Down
1 change: 1 addition & 0 deletions examples/codesandbox/garden-create-react-app/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SKIP_PREFLIGHT_CHECK=true
23 changes: 23 additions & 0 deletions examples/codesandbox/garden-create-react-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
11 changes: 11 additions & 0 deletions examples/codesandbox/garden-create-react-app/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"fluid": false
}
59 changes: 59 additions & 0 deletions examples/codesandbox/garden-create-react-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"private": true,
"name": "garden-create-react-app",
"description": "An example application using the Zendesk Garden React Components",
"version": "0.0.0",
"scripts": {
"build": "react-scripts build",
"eject": "react-scripts eject",
"start": "react-scripts start",
"test": "react-scripts test"
},
"dependencies": {
"@zendeskgarden/css-bedrock": "^7.0.25",
"@zendeskgarden/css-variables": "^6.3.4",
"@zendeskgarden/react-avatars": "^6.0.0",
"@zendeskgarden/react-buttons": "^6.0.0",
"@zendeskgarden/react-chrome": "^6.0.0",
"@zendeskgarden/react-dropdowns": "^6.0.0",
"@zendeskgarden/react-grid": "^6.0.0",
"@zendeskgarden/react-loaders": "^6.0.0",
"@zendeskgarden/react-modals": "^6.0.0",
"@zendeskgarden/react-notifications": "^6.0.0",
"@zendeskgarden/react-pagination": "^6.0.0",
"@zendeskgarden/react-ranges": "^6.0.0",
"@zendeskgarden/react-tables": "^6.0.0",
"@zendeskgarden/react-tabs": "^6.0.0",
"@zendeskgarden/react-tags": "^6.0.0",
"@zendeskgarden/react-theming": "^6.0.0",
"@zendeskgarden/react-typography": "^6.0.0",
"@zendeskgarden/svg-icons": "^6.3.0",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.1",
"styled-components": "^4.3.1"
},
"keywords": [
"a11y",
"accessible",
"garden",
"react",
"zendesk"
],
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"eslintConfig": {
"extends": "react-app"
}
}
Binary file not shown.
38 changes: 38 additions & 0 deletions examples/codesandbox/garden-create-react-app/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
15 changes: 15 additions & 0 deletions examples/codesandbox/garden-create-react-app/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React from 'react';
import styled from 'styled-components';
import { zdSpacingLg } from '@zendeskgarden/css-variables';
import {
Chrome,
Nav,
NavItem,
NavItemIcon,
NavItemText,
Body,
Content,
Main
} from '@zendeskgarden/react-chrome';

import { ReactComponent as ZendeskIcon } from '@zendeskgarden/svg-icons/src/26/zendesk.svg';
import { ReactComponent as HomeIcon } from '@zendeskgarden/svg-icons/src/26/home-fill.svg';

const PaddedMain = styled(Main)`
padding: ${zdSpacingLg};
`;

const ExampleWrapper = ({ children }) => (
<Chrome>
<Nav expanded>
<NavItem logo title="Zendesk Garden Code Sample">
<NavItemIcon>
<ZendeskIcon />
</NavItemIcon>
<NavItemText>Zendesk Connect</NavItemText>
</NavItem>
<NavItem title="Home" current>
<NavItemIcon>
<HomeIcon />
</NavItemIcon>
<NavItemText>Home</NavItemText>
</NavItem>
<NavItem brandmark title="&copy;Zendesk">
<NavItemIcon>
<ZendeskIcon />
</NavItemIcon>
<NavItemText>&copy;Zendesk</NavItemText>
</NavItem>
</Nav>
<Body>
<Content>
<PaddedMain>{children}</PaddedMain>
</Content>
</Body>
</Chrome>
);

export default ExampleWrapper;
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import React, { Component } from 'react';
import styled from 'styled-components';
import {
zdSpacing,
zdSpacingSm,
zdSpacingXl,
zdFontWeightSemibold,
zdColorBlue600
} from '@zendeskgarden/css-variables';
import { XXL, MD } from '@zendeskgarden/react-typography';
import { Button, Anchor } from '@zendeskgarden/react-buttons';
import { Dots } from '@zendeskgarden/react-loaders';
import { Dropdown, Trigger, Menu, Item } from '@zendeskgarden/react-dropdowns';

const Header = styled(XXL)`
margin-bottom: ${zdSpacing};
`;

const Paragraph = styled.p`
margin-bottom: ${zdSpacingSm};
`;

const Strong = styled.strong`
font-weight: ${zdFontWeightSemibold};
`;

const CodeExample = styled.div`
margin-top: ${zdSpacingXl};
text-align: center;
`;

export default class Example extends Component {
render() {
return (
<>
<Header tag="h1">Zendesk Garden Code Sample</Header>
<MD>
<Paragraph>
This CodeSandbox is an example codebase of the{' '}
<Anchor href="https://garden.zendesk.com/react-components">
Garden react-components
</Anchor>{' '}
using the{' '}
<Anchor href="https://github.com/facebook/create-react-app">
create-react-app
</Anchor>{' '}
template.
</Paragraph>
<Paragraph>
To edit this example, modify the{' '}
<Strong>examples/Example.js</Strong> file.
</Paragraph>
</MD>
<CodeExample>
<Dropdown>
<Trigger>
<Button>Open a menu</Button>
</Trigger>
<Menu>
<Item value="option-1">Option 1</Item>
<Item value="option-2">Option 2</Item>
</Menu>
</Dropdown>
</CodeExample>
<CodeExample>
<Dots color={zdColorBlue600} size={40} />
</CodeExample>
</>
);
}
}
16 changes: 16 additions & 0 deletions examples/codesandbox/garden-create-react-app/src/global-styling.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/** Some opinionated style resets for Zendesk products. Optional. */
import '@zendeskgarden/css-bedrock';

/** Component styles */
import '@zendeskgarden/react-avatars/dist/styles.css';
import '@zendeskgarden/react-buttons/dist/styles.css';
import '@zendeskgarden/react-chrome/dist/styles.css';
import '@zendeskgarden/react-dropdowns/dist/styles.css';
import '@zendeskgarden/react-grid/dist/styles.css';
import '@zendeskgarden/react-modals/dist/styles.css';
import '@zendeskgarden/react-tags/dist/styles.css';
import '@zendeskgarden/react-notifications/dist/styles.css';
import '@zendeskgarden/react-pagination/dist/styles.css';
import '@zendeskgarden/react-ranges/dist/styles.css';
import '@zendeskgarden/react-tabs/dist/styles.css';
import '@zendeskgarden/react-tables/dist/styles.css';
23 changes: 23 additions & 0 deletions examples/codesandbox/garden-create-react-app/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { ThemeProvider } from '@zendeskgarden/react-theming';

/** Local components */
import ExampleWrapper from './components/ExampleWrapper';
import Example from './examples/Example';

/** Global styling */
import './global-styling.js';

function App() {
return (
<ThemeProvider>
<ExampleWrapper>
<Example />
</ExampleWrapper>
</ThemeProvider>
);
}

const rootElement = document.getElementById('root');
ReactDOM.render(<App />, rootElement);
Loading