Skip to content

Commit 8fe4e90

Browse files
authored
Merge branch 'develop' into arm-platform
2 parents 55ca0f9 + dd2f731 commit 8fe4e90

File tree

85 files changed

+31047
-61309
lines changed

Some content is hidden

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

85 files changed

+31047
-61309
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
blank_issues_enabled: false
2+
3+
contact_links:
4+
- name: 🌸 p5.js Issues
5+
url: https://github.com/processing/p5.js/issues
6+
about: Report issues with the p5.js here.
7+
- name: 🌐 Website Issues
8+
url: https://github.com/processing/p5.js-website/issues
9+
about: Report issues with the p5.js website here.
10+
- name: 💬 Forum
11+
url: https://discourse.processing.org/c/p5js
12+
about: Have other questions about using p5.js? Ask them here!
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 💡 Existing Feature Enhancement
2+
description: Suggest an improvement to an existing feature.
3+
labels: [ Enhancement ]
4+
body:
5+
- type: textarea
6+
attributes:
7+
label: Increasing Access
8+
description: How would this new feature help [increase access](https://github.com/processing/p5.js/blob/main/contributor_docs/access.md) to the p5.js Web Editor? (If you're not sure, you can type "Unsure" here and let others from the community offer their thoughts.)
9+
validations:
10+
required: true
11+
12+
- type: textarea
13+
attributes:
14+
label: Feature enhancement details
15+
validations:
16+
required: true
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 🌱 New Feature Request
2+
description: Request a new feature be added.
3+
labels: [ Feature Request ]
4+
body:
5+
- type: textarea
6+
attributes:
7+
label: Increasing Access
8+
description: How would this new feature help [increase access](https://github.com/processing/p5.js/blob/main/contributor_docs/access.md) to the p5.js Web Editor? (If you're not sure, you can type "Unsure" here and let others from the community offer their thoughts.)
9+
validations:
10+
required: true
11+
12+
- type: textarea
13+
attributes:
14+
label: Feature request details
15+
validations:
16+
required: true
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: 🐛 Found a Bug
2+
description: Report p5.js web editor bugs (broken or incorrect behaviour).
3+
labels: [ Bug ]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
- Please make sure to [search for existing issues](https://github.com/processing/p5.js-web-editor/issues) before filing a new one!
9+
10+
- type: input
11+
attributes:
12+
label: p5.js version
13+
description: You can find this in the first line of the p5.js file.
14+
validations:
15+
required: false
16+
17+
- type: dropdown
18+
attributes:
19+
label: What is your operating system?
20+
options:
21+
- Windows
22+
- Mac OS
23+
- Linux
24+
- Android
25+
- iOS
26+
- Other (specify if possible)
27+
validations:
28+
required: false
29+
30+
- type: input
31+
attributes:
32+
label: Web browser and version
33+
description: |
34+
In the address bar, on Chrome enter `chrome://version`, on Firefox enter `about:support`. On Safari, use `About Safari`.
35+
validations:
36+
required: false
37+
38+
- type: textarea
39+
attributes:
40+
label: Actual Behavior
41+
placeholder: What is currently happening.
42+
validations:
43+
required: true
44+
45+
- type: textarea
46+
attributes:
47+
label: Expected Behavior
48+
description: |
49+
If you want to include screenshots, paste them into the markdown editor below.
50+
placeholder: What were you expecting?
51+
validations:
52+
required: true
53+
54+
- type: textarea
55+
attributes:
56+
label: Steps to reproduce
57+
description: |
58+
- Add steps to reproduce bugs or add information on the place where the feature should be implemented.
59+
- Add links to a sample deployment or code.
60+
value: "### Steps:
61+
62+
1.
63+
2.
64+
3.
65+
66+
### Snippet:
67+
68+
```js
69+
70+
71+
// Paste your code here :)
72+
73+
74+
```"
75+
validations:
76+
required: true

.github/ISSUE_TEMPLATE/🌱-new-feature-request.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/🐛-found-a-bug.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/💡-existing-feature-enhancement.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ terraform/.terraform/
2020

2121
storybook-static
2222
duplicates.json
23+
24+
coverage

client/common/ButtonOrLink.jsx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import React from 'react';
2+
import { Link } from 'react-router';
3+
import PropTypes from 'prop-types';
4+
5+
/**
6+
* Helper for switching between <button>, <a>, and <Link>
7+
*/
8+
const ButtonOrLink = ({ href, children, ...props }) => {
9+
if (href) {
10+
if (href.startsWith('http')) {
11+
return (
12+
<a href={href} target="_blank" rel="noopener noreferrer" {...props}>
13+
{children}
14+
</a>
15+
);
16+
}
17+
return (
18+
<Link to={href} {...props}>
19+
{children}
20+
</Link>
21+
);
22+
}
23+
return <button {...props}>{children}</button>;
24+
};
25+
26+
/**
27+
* Accepts all the props of an HTML <a> or <button> tag.
28+
*/
29+
ButtonOrLink.propTypes = {
30+
/**
31+
* If providing an href, will render as a link instead of a button.
32+
* Can be internal or external.
33+
* Internal links will use react-router.
34+
* External links should start with 'http' or 'https' and will open in a new window.
35+
*/
36+
href: PropTypes.string,
37+
/**
38+
* Content of the button/link.
39+
* Can be either a string or a complex element.
40+
*/
41+
children: PropTypes.node.isRequired
42+
};
43+
44+
ButtonOrLink.defaultProps = {
45+
href: null
46+
};
47+
48+
export default ButtonOrLink;

client/common/ButtonOrLink.test.jsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import React from 'react';
2+
import { render, screen, fireEvent } from '../test-utils';
3+
import ButtonOrLink from './ButtonOrLink';
4+
5+
describe('ButtonOrLink', () => {
6+
const clickHandler = jest.fn();
7+
8+
afterEach(() => {
9+
clickHandler.mockClear();
10+
});
11+
12+
it('can render a clickable button', () => {
13+
render(<ButtonOrLink onClick={clickHandler}>Text</ButtonOrLink>);
14+
const button = screen.getByRole('button');
15+
expect(button).toBeInstanceOf(HTMLButtonElement);
16+
expect(button).toContainHTML('<button>Text</button>');
17+
fireEvent.click(button);
18+
expect(clickHandler).toHaveBeenCalled();
19+
});
20+
21+
it('can render an external link', () => {
22+
render(<ButtonOrLink href="https://p5js.org">p5</ButtonOrLink>);
23+
const link = screen.getByRole('link');
24+
expect(link).toBeInstanceOf(HTMLAnchorElement);
25+
expect(link).toHaveAttribute('href', 'https://p5js.org');
26+
});
27+
28+
it('can render an internal link with react-router', () => {
29+
render(<ButtonOrLink href="/about">About</ButtonOrLink>);
30+
// TODO: how can this be tested? Needs a router provider?
31+
});
32+
});

0 commit comments

Comments
 (0)