Skip to content

Commit 96b0a39

Browse files
committed
merge with develop and update to /common pr
2 parents fd42fa4 + 7999ada commit 96b0a39

Some content is hidden

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

75 files changed

+2023
-985
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"no-restricted-exports": 1,
4343
"no-underscore-dangle": 0,
4444
"no-useless-catch": 2,
45+
"no-plusplus": "off",
4546
"prefer-object-spread": 0,
4647
"max-len": [1, 120, 2, {"ignoreComments": true, "ignoreTemplateLiterals": true}],
4748
"max-classes-per-file": 0,

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ We are a community of, and in solidarity with, people from every gender identity
1010

1111
Learn more about [our community](https://p5js.org/community/) and read our [Community Statement and Code of Conduct](./.github/CODE_OF_CONDUCT.md). You can directly support our work with p5.js by [donating to the Processing Foundation](https://processingfoundation.org/support).
1212

13+
Stay in touch with Processing Foundation across other platforms:
14+
- [Instagram](https://www.instagram.com/p5xjs)
15+
- [Youtube](https://www.youtube.com/@ProcessingFoundation)
16+
- [X](https://x.com/p5xjs)
17+
- Discord (invitation link coming soon!)
18+
- [Forum](https://discourse.processing.org)
19+
20+
1321
## Using the p5.js Editor 🤔
1422

1523
Make your first sketch in the [p5.js Editor](https://editor.p5js.org/)! Learn more about sketching with p5.js on the [Get Started](https://p5js.org/tutorials/get-started/) and find everything you can do in the [Reference](https://p5js.org/reference/). You can also look at [examples](https://editor.p5js.org/p5/sketches) and remix them in the p5.js Editor.

client/common/Button.stories.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { action } from '@storybook/addon-actions';
33

4-
import { Button } from './Button';
4+
import { Button, ButtonDisplays, ButtonKinds, ButtonTypes } from './Button';
55
import { GithubIcon, DropdownArrowIcon, PlusIcon } from './icons';
66

77
export default {
@@ -15,13 +15,13 @@ export default {
1515
};
1616

1717
export const AllFeatures = (args) => (
18-
<Button disabled={args.disabled} type="submit" label={args.label}>
18+
<Button disabled={args.disabled} type={ButtonTypes.SUBMIT} label={args.label}>
1919
{args.children}
2020
</Button>
2121
);
2222

2323
export const SubmitButton = () => (
24-
<Button type="submit" label="submit">
24+
<Button type={ButtonTypes.SUBMIT} label="submit">
2525
This is a submit button
2626
</Button>
2727
);
@@ -59,7 +59,7 @@ export const ButtonWithIconAfter = () => (
5959
);
6060

6161
export const InlineButtonWithIconAfter = () => (
62-
<Button iconAfter={<DropdownArrowIcon />} display={Button.displays.inline}>
62+
<Button iconAfter={<DropdownArrowIcon />} display={ButtonDisplays.INLINE}>
6363
File name
6464
</Button>
6565
);
@@ -68,6 +68,6 @@ export const InlineIconOnlyButton = () => (
6868
<Button
6969
aria-label="Add to collection"
7070
iconBefore={<PlusIcon />}
71-
display={Button.displays.inline}
71+
display={ButtonDisplays.INLINE}
7272
/>
7373
);

client/common/Button.tsx

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,36 @@ import styled from 'styled-components';
33
import { Link } from 'react-router-dom';
44
import { remSize, prop } from '../theme';
55

6-
enum Kinds {
7-
primary = 'primary',
8-
secondary = 'secondary'
6+
/**
7+
* Enum for the visual style of a Button.
8+
*
9+
* These values transpile to lowercase strings (`'primary' | 'secondary'`)
10+
* that map directly to keys in the `Button` object in `theme.js` for styling.
11+
*/
12+
export enum ButtonKinds {
13+
PRIMARY = 'primary',
14+
SECONDARY = 'secondary'
915
}
10-
11-
enum Displays {
12-
block = 'block',
13-
inline = 'inline'
16+
/**
17+
* Enum for the display type of a Button.
18+
*
19+
* These values transpile to lowercase strings (`'block' | 'inline'`)
20+
* and map to display styles in the `Button` object in `theme.js`.
21+
*/
22+
export enum ButtonDisplays {
23+
BLOCK = 'block',
24+
INLINE = 'inline'
1425
}
15-
16-
enum ButtonTypes {
17-
button = 'button',
18-
submit = 'submit'
26+
/**
27+
* Enum for the native HTML button type.
28+
*
29+
* These values transpile to lowercase strings (`'button' | 'submit'`)
30+
* and correspond to the `type` attribute on a native <button>.
31+
* They can also be used in `theme.js` if needed for button-specific styles.
32+
*/
33+
export enum ButtonTypes {
34+
BUTTON = 'button',
35+
SUBMIT = 'submit'
1936
}
2037

2138
export interface ButtonProps extends React.HTMLAttributes<HTMLElement> {
@@ -31,7 +48,7 @@ export interface ButtonProps extends React.HTMLAttributes<HTMLElement> {
3148
/**
3249
* The display type of the button—inline or block
3350
*/
34-
display?: Displays;
51+
display?: ButtonDisplays;
3552
/**
3653
* SVG icon to place after child content
3754
*/
@@ -47,7 +64,7 @@ export interface ButtonProps extends React.HTMLAttributes<HTMLElement> {
4764
/**
4865
* The kind of button - determines how it appears visually
4966
*/
50-
kind?: Kinds;
67+
kind?: ButtonKinds;
5168
/**
5269
* Specifying an href will use an <a> to link to the URL
5370
*/
@@ -69,15 +86,17 @@ export interface ButtonProps extends React.HTMLAttributes<HTMLElement> {
6986
*/
7087
type?: ButtonTypes;
7188
/**
72-
* Allows for IconButton to pass `focusable="false"` as a prop for SVGs.
73-
* See @types/react > interface SVGAttributes<T> extends AriaAttributes, DOMAttributes<T>
89+
* Controls whether the underlying SVG is focusable.
90+
* Only relevant for IconButton (or buttons that render an SVG as content).
91+
* In SVGs, the `focusable` attribute must be a string (`"true"` or `"false"`),
92+
* but React will automatically convert a boolean prop to the correct string value.
7493
*/
75-
focusable?: boolean | 'true' | 'false';
94+
focusable?: boolean;
7695
}
7796

7897
interface StyledButtonProps extends ButtonProps {
79-
kind: Kinds;
80-
display: Displays;
98+
kind: ButtonKinds;
99+
display: ButtonDisplays;
81100
}
82101

83102
// The '&&&' will increase the specificity of the
@@ -87,7 +106,7 @@ const StyledButton = styled.button<StyledButtonProps>`
87106
&&& {
88107
font-weight: bold;
89108
display: ${({ display }) =>
90-
display === Displays.inline ? 'inline-flex' : 'flex'};
109+
display === ButtonDisplays.INLINE ? 'inline-flex' : 'flex'};
91110
justify-content: center;
92111
align-items: center;
93112
@@ -181,15 +200,15 @@ const StyledInlineButton = styled.button`
181200
*/
182201
export const Button = ({
183202
children = null,
184-
display = Displays.block,
203+
display = ButtonDisplays.BLOCK,
185204
href,
186-
kind = Kinds.primary,
205+
kind = ButtonKinds.PRIMARY,
187206
iconBefore = null,
188207
iconAfter = null,
189208
iconOnly = false,
190209
'aria-label': ariaLabel,
191210
to,
192-
type = ButtonTypes.button,
211+
type = ButtonTypes.BUTTON,
193212
...props
194213
}: ButtonProps) => {
195214
const hasChildren = React.Children.count(children) > 0;
@@ -249,6 +268,3 @@ export const Button = ({
249268
</StyledComponent>
250269
);
251270
};
252-
253-
Button.kinds = Kinds;
254-
Button.displays = Displays;

client/common/IconButton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { ComponentType } from 'react';
22
import styled from 'styled-components';
3-
import { Button, ButtonProps } from './Button';
3+
import { Button, ButtonProps, ButtonDisplays } from './Button';
44
import { remSize } from '../theme';
55

66
const ButtonWrapper = styled(Button)`
@@ -23,8 +23,8 @@ export const IconButton = ({ icon: Icon, ...otherProps }: IconButtonProps) => (
2323
<ButtonWrapper
2424
iconBefore={Icon ? <Icon /> : undefined}
2525
iconOnly
26-
display={Button.displays.inline}
27-
focusable="false"
26+
display={ButtonDisplays.INLINE}
27+
focusable={false}
2828
{...otherProps}
2929
/>
3030
);

client/i18n.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { initReactI18next } from 'react-i18next';
33
import Backend from 'i18next-http-backend';
44

55
import {
6-
be,
6+
bn,
77
enUS,
88
es,
99
ja,
@@ -21,12 +21,12 @@ import {
2121
enIN
2222
} from 'date-fns/locale';
2323

24-
import getPreferredLanguage from './utils/language-utils';
24+
import { getPreferredLanguage } from './utils/language-utils';
2525

2626
const fallbackLng = ['en-US'];
2727

2828
export const availableLanguages = [
29-
'be',
29+
'bn',
3030
'de',
3131
'en-US',
3232
'es-419',
@@ -61,7 +61,7 @@ if (
6161

6262
export function languageKeyToLabel(lang) {
6363
const languageMap = {
64-
be: 'বাংলা',
64+
bn: 'বাংলা',
6565
de: 'Deutsch',
6666
'en-US': 'English',
6767
'es-419': 'Español',
@@ -83,7 +83,7 @@ export function languageKeyToLabel(lang) {
8383

8484
export function languageKeyToDateLocale(lang) {
8585
const languageMap = {
86-
be,
86+
bn,
8787
de,
8888
'en-US': enUS,
8989
'es-419': es,

client/modules/IDE/actions/assets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import apiClient from '../../../utils/apiClient';
1+
import { apiClient } from '../../../utils/apiClient';
22
import * as ActionTypes from '../../../constants';
33
import { startLoader, stopLoader } from '../reducers/loading';
44
import { assetsActions } from '../reducers/assets';

client/modules/IDE/actions/collections.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import browserHistory from '../../../browserHistory';
2-
import apiClient from '../../../utils/apiClient';
2+
import { apiClient } from '../../../utils/apiClient';
33
import * as ActionTypes from '../../../constants';
44
import { startLoader, stopLoader } from '../reducers/loading';
55
import { setToastText, showToast } from './toast';

client/modules/IDE/actions/files.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import objectID from 'bson-objectid';
22
import blobUtil from 'blob-util';
3-
import apiClient from '../../../utils/apiClient';
3+
import { apiClient } from '../../../utils/apiClient';
44
import * as ActionTypes from '../../../constants';
55
import {
66
setUnsavedChanges,

client/modules/IDE/actions/preferences.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import i18next from 'i18next';
2-
import apiClient from '../../../utils/apiClient';
2+
import { apiClient } from '../../../utils/apiClient';
33
import * as ActionTypes from '../../../constants';
44

55
function updatePreferences(formParams, dispatch) {

0 commit comments

Comments
 (0)