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

sync: master to alpha #2162

Merged
merged 31 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
b14ea5f
feat: add icon size xs that looks good against a 1rem font (#2149)
keithgg Mar 24, 2023
6d85843
docs: update dependent-usage.json (#2163)
github-actions[bot] Mar 25, 2023
1ac063b
docs: update dependent-usage.json (#2164)
github-actions[bot] Mar 26, 2023
cbe4282
docs: update dependent-usage.json (#2167)
github-actions[bot] Mar 27, 2023
9c65af9
docs: update dependent-usage.json (#2168)
github-actions[bot] Mar 28, 2023
5179d5e
chore: update browserslist DB (#2165)
edx-requirements-bot Mar 28, 2023
5eb9271
docs: update dependent-usage.json (#2169)
github-actions[bot] Mar 29, 2023
998dfe3
test: improve coverage by adding tests for ButtonToolbar and ButtonGr…
keithgg Mar 29, 2023
6e69a4e
docs: update dependent-usage.json (#2171)
github-actions[bot] Mar 30, 2023
c6c12e7
docs: update dependent-usage.json (#2172)
github-actions[bot] Apr 1, 2023
08acb11
docs: update dependent-usage.json (#2173)
github-actions[bot] Apr 2, 2023
e7aad58
docs: update dependent-usage.json (#2175)
github-actions[bot] Apr 3, 2023
05476c2
docs: update dependent-usage.json (#2176)
github-actions[bot] Apr 4, 2023
fc24230
feat: create new ColorPicker component (#2003)
kiram15 Apr 4, 2023
e29296b
docs: update dependent-usage.json (#2178)
github-actions[bot] Apr 5, 2023
e750a48
docs: update dependent-usage.json (#2180)
github-actions[bot] Apr 6, 2023
e4a2e48
fix: add success and danger checked svgs (#2001)
rayzhou-bit Apr 7, 2023
a85d135
chore: update browserslist DB (#2174)
edx-requirements-bot Apr 7, 2023
8eb2459
docs: update dependent-usage.json (#2182)
github-actions[bot] Apr 7, 2023
d462580
docs: update dependent-usage.json (#2183)
github-actions[bot] Apr 8, 2023
31de5bc
docs: update dependent-usage.json (#2184)
github-actions[bot] Apr 9, 2023
0971d6d
docs: update dependent-usage.json (#2186)
github-actions[bot] Apr 10, 2023
b2fb167
docs: update dependent-usage.json (#2187)
github-actions[bot] Apr 11, 2023
987d421
docs: update dependent-usage.json (#2188)
github-actions[bot] Apr 12, 2023
d4f4dc6
docs: update dependent-usage.json (#2191)
github-actions[bot] Apr 13, 2023
19e460d
docs: update dependent-usage.json (#2193)
github-actions[bot] Apr 14, 2023
f40130c
docs: update dependent-usage.json (#2195)
github-actions[bot] Apr 15, 2023
cdc02e4
docs: update dependent-usage.json (#2196)
github-actions[bot] Apr 16, 2023
238925d
docs: update dependent-usage.json (#2198)
github-actions[bot] Apr 17, 2023
77a0dcc
docs: update dependent-usage.json (#2199)
github-actions[bot] Apr 19, 2023
96afc04
docs: update dependent-usage.json (#2203)
github-actions[bot] Apr 20, 2023
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,100 changes: 2,101 additions & 1,999 deletions dependent-usage.json

Large diffs are not rendered by default.

32 changes: 26 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"mailto-link": "^2.0.0",
"prop-types": "^15.8.1",
"react-bootstrap": "^1.6.5",
"react-colorful": "^5.6.1",
"react-dropzone": "^14.2.1",
"react-focus-on": "^3.5.4",
"react-loading-skeleton": "^3.1.0",
Expand Down
12 changes: 12 additions & 0 deletions src/Button/Button.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ describe('<Button />', () => {
const tooltip = wrapper.find('.btn');
expect(tooltip.hasClass('btn-brand')).toEqual(true);
});
it('renders with props iconBefore and size', () => {
const tree = renderer.create((
<Button iconBefore={Close} size="md">Button</Button>
)).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders with props iconAfter and size', () => {
const tree = renderer.create((
<Button iconAfter={Close} size="md">Button</Button>
)).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders with props iconBefore', () => {
const tree = renderer.create((
<Button iconBefore={Close}>Button</Button>
Expand Down
26 changes: 26 additions & 0 deletions src/Button/ButtonGroup.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import renderer from 'react-test-renderer';

import Button, { ButtonGroup } from './index';

describe('<ButtonGroup />', () => {
describe('correct rendering', () => {
it('renders without props', () => {
const tree = renderer.create((
<ButtonGroup />
)).toJSON();
expect(tree).toMatchSnapshot();
});

it('renders with children', () => {
const tree = renderer.create((
<ButtonGroup size="lg">
<Button variant="primary">Left</Button>
<Button variant="primary">Middle</Button>
<Button variant="primary">Right</Button>
</ButtonGroup>
)).toJSON();
expect(tree).toMatchSnapshot();
});
});
});
15 changes: 15 additions & 0 deletions src/Button/ButtonToolbar.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import renderer from 'react-test-renderer';

import { ButtonToolbar } from './index';

describe('<ButtonToolbar />', () => {
describe('correct rendering', () => {
it('renders without props', () => {
const tree = renderer.create((
<ButtonToolbar />
)).toJSON();
expect(tree).toMatchSnapshot();
});
});
});
58 changes: 58 additions & 0 deletions src/Button/__snapshots__/Button.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,35 @@ exports[`<Button /> correct rendering renders with props iconAfter 1`] = `
</button>
`;

exports[`<Button /> correct rendering renders with props iconAfter and size 1`] = `
<button
className="btn btn-primary btn-md"
disabled={false}
type="button"
>
Button
<span
className="pgn__icon pgn__icon__md btn-icon-after"
>
<svg
aria-hidden={true}
fill="none"
focusable={false}
height={24}
role="img"
viewBox="0 0 24 24"
width={24}
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
fill="currentColor"
/>
</svg>
</span>
</button>
`;

exports[`<Button /> correct rendering renders with props iconBefore 1`] = `
<button
className="btn btn-primary"
Expand Down Expand Up @@ -130,6 +159,35 @@ exports[`<Button /> correct rendering renders with props iconBefore and iconAfte
</button>
`;

exports[`<Button /> correct rendering renders with props iconBefore and size 1`] = `
<button
className="btn btn-primary btn-md"
disabled={false}
type="button"
>
<span
className="pgn__icon pgn__icon__md btn-icon-before"
>
<svg
aria-hidden={true}
fill="none"
focusable={false}
height={24}
role="img"
viewBox="0 0 24 24"
width={24}
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
fill="currentColor"
/>
</svg>
</span>
Button
</button>
`;

exports[`<Button /> correct rendering renders without props 1`] = `
<button
className="btn btn-primary"
Expand Down
37 changes: 37 additions & 0 deletions src/Button/__snapshots__/ButtonGroup.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<ButtonGroup /> correct rendering renders with children 1`] = `
<div
className="btn-group btn-group-lg"
role="group"
>
<button
className="btn btn-primary"
disabled={false}
type="button"
>
Left
</button>
<button
className="btn btn-primary"
disabled={false}
type="button"
>
Middle
</button>
<button
className="btn btn-primary"
disabled={false}
type="button"
>
Right
</button>
</div>
`;

exports[`<ButtonGroup /> correct rendering renders without props 1`] = `
<div
className="btn-group btn-group-md"
role="group"
/>
`;
8 changes: 8 additions & 0 deletions src/Button/__snapshots__/ButtonToolbar.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<ButtonToolbar /> correct rendering renders without props 1`] = `
<div
className="btn-toolbar"
role="toolbar"
/>
`;
4 changes: 2 additions & 2 deletions src/Button/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const WrappedButton = React.forwardRef(({
className={classNames(props.className)}
ref={ref}
>
{iconBefore && <Icon className={classNames('btn-icon-before', props.size && `pgn__icon__${props.size}`)} src={iconBefore} />}
{iconBefore && <Icon className="btn-icon-before" size={props.size} src={iconBefore} />}
{children}
{iconAfter && <Icon className={classNames('btn-icon-after', props.size && `pgn__icon__${props.size}`)} src={iconAfter} />}
{iconAfter && <Icon className="btn-icon-after" size={props.size} src={iconAfter} />}
</Button>
));

Expand Down
52 changes: 52 additions & 0 deletions src/ColorPicker/ColorPicker.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
@import "variables";

.pgn__color-picker {
box-shadow: 0 0 3px 1px $gray-300;
border: none;
background:
linear-gradient(to bottom right,
rgb(255, 0, 0) 0%,
rgb(255, 154, 0) 17%,
rgb(208, 222, 33) 33%,
rgb(79, 220, 74) 40%,
rgb(28, 127, 238) 75%,
rgb(95, 21, 242) 86%,
rgb(186, 12, 248) 100%
);

&.pgn__color-picker-sm {
height: $picker-size-sm;
width: $picker-size-sm;
}

&.pgn__color-picker-md {
height: $picker-size-md;
width: $picker-size-md;
}
}

.pgn__color-modal {
background: $white;
padding-bottom: .1rem;
margin-bottom: 1rem;
}

.pgn__color-error {
font-size: 70%;
}

.pgn__hex-form {
display: flex;
max-width: 180px;
margin: 5px;

h5 {
margin: 10px;
}

.form-field {
@media (min-width: map-get($grid-breakpoints, "sm")) {
margin-inline-end: 0;
}
}
}
42 changes: 42 additions & 0 deletions src/ColorPicker/ColorPicker.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from 'react';
import renderer from 'react-test-renderer';
import userEvent from '@testing-library/user-event';
import { render, fireEvent, screen } from '@testing-library/react';
import { act } from 'react-dom/test-utils';
import '@testing-library/jest-dom';
import ColorPicker from './index';

describe('renders correctly', () => {
const color = '';
const setColor = jest.fn();
it('successfully renders', () => {
const tree = renderer.create(<ColorPicker color={color} setColor={setColor} />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders with defaults', () => {
const { container } = render(<ColorPicker color={color} setColor={setColor} />);
expect(container.firstChild.firstChild).toHaveClass('pgn__color-picker-md');
});
it('renders with the passed variables ', () => {
const className = 'testClassName';
const { container } = render(
<ColorPicker color={color} setColor={setColor} className={className} size="lg" />,
);
expect(container.firstChild.firstChild).toHaveClass(className);
expect(container.firstChild.firstChild).toHaveClass('pgn__color-picker-lg');
});
});
describe('picker works as expected', () => {
const color = 'wassap';
const setColor = jest.fn();
it('validates hex color', async () => {
render(<ColorPicker color={color} setColor={setColor} />);
await act(async () => {
userEvent.click(screen.getByRole('button'));
});
expect(screen.queryByText('Colors must be in hexadecimal format.')).toBeInTheDocument();
const input = screen.getByTestId('hex-input');
fireEvent.change(input, { target: { value: '#32116c' } });
expect(screen.queryByText('Colors must be in hexadecimal format.')).not.toBeInTheDocument();
});
});
Loading