Skip to content

Commit 4521042

Browse files
author
Matthew Holloway
committed
Resolving conflicts
2 parents a9ece1b + 00355ad commit 4521042

File tree

14 files changed

+2948
-2654
lines changed

14 files changed

+2948
-2654
lines changed

CODE_OF_CONDUCT.md

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,43 @@
55
In the interest of fostering an open and welcoming environment, we as
66
contributors and maintainers pledge to making participation in our project and
77
our community a harassment-free experience for everyone, regardless of age, body
8-
size, disability, ethnicity, sex characteristics, gender identity and expression,
9-
level of experience, education, socio-economic status, nationality, personal
10-
appearance, race, religion, or sexual identity and orientation.
8+
size, disability, ethnicity, sex characteristics, gender identity and
9+
expression, level of experience, education, socio-economic status, nationality,
10+
personal appearance, race, religion, or sexual identity and orientation.
1111

1212
## Our Standards
1313

1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
30-
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
32-
professional setting
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
3333

3434
## Our Responsibilities
3535

3636
Project maintainers are responsible for clarifying the standards of acceptable
3737
behavior and are expected to take appropriate and fair corrective action in
3838
response to any instances of unacceptable behavior.
3939

40-
Project maintainers have the right and responsibility to remove, edit, or
41-
reject comments, commits, code, wiki edits, issues, and other contributions
42-
that are not aligned to this Code of Conduct, or to ban temporarily or
43-
permanently any contributor for other behaviors that they deem inappropriate,
44-
threatening, offensive, or harmful.
40+
Project maintainers have the right and responsibility to remove, edit, or reject
41+
comments, commits, code, wiki edits, issues, and other contributions that are
42+
not aligned to this Code of Conduct, or to ban temporarily or permanently any
43+
contributor for other behaviors that they deem inappropriate, threatening,
44+
offensive, or harmful.
4545

4646
## Scope
4747

@@ -58,17 +58,19 @@ Instances of abusive, harassing, or otherwise unacceptable behavior may be
5858
reported by contacting the project team at [email protected]. All
5959
complaints will be reviewed and investigated and will result in a response that
6060
is deemed necessary and appropriate to the circumstances. The project team is
61-
obligated to maintain confidentiality with regard to the reporter of an incident.
62-
Further details of specific enforcement policies may be posted separately.
61+
obligated to maintain confidentiality with regard to the reporter of an
62+
incident. Further details of specific enforcement policies may be posted
63+
separately.
6364

6465
Project maintainers who do not follow or enforce the Code of Conduct in good
6566
faith may face temporary or permanent repercussions as determined by other
6667
members of the project's leadership.
6768

6869
## Attribution
6970

70-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71-
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
71+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
72+
version 1.4, available at
73+
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
7274

7375
[homepage]: https://www.contributor-covenant.org
7476

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = api => {
1+
module.exports = (api) => {
22
api.cache(true);
33

44
const presets = [

demo/src/code-examples.tsx

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
export const ExampleDefault = `import {
2+
Accordion,
3+
AccordionItem,
4+
AccordionItemButton,
5+
AccordionItemHeading,
6+
AccordionItemPanel,
7+
} from 'react-accessible-accordion';
8+
9+
<Accordion>
10+
{items.map((item) => (
11+
<AccordionItem key={item.uuid}>
12+
<AccordionItemHeading>
13+
<AccordionItemButton>
14+
{item.heading}
15+
</AccordionItemButton>
16+
</AccordionItemHeading>
17+
<AccordionItemPanel>
18+
{item.content}
19+
</AccordionItemPanel>
20+
</AccordionItem>
21+
))}
22+
</Accordion>`;
23+
24+
export const ExampleAllowMultipleExpanded = `<Accordion allowMultipleExpanded>
25+
{items.map((item) => (
26+
<AccordionItem key={item.uuid}>
27+
<AccordionItemHeading>
28+
<AccordionItemButton>
29+
{item.heading}
30+
</AccordionItemButton>
31+
</AccordionItemHeading>
32+
<AccordionItemPanel>
33+
{item.content}
34+
</AccordionItemPanel>
35+
</AccordionItem>
36+
))}
37+
</Accordion>`;
38+
39+
export const ExampleAllowZeroExpanded = `<Accordion allowZeroExpanded>
40+
{items.map((item) => (
41+
<AccordionItem key={item.uuid}>
42+
<AccordionItemHeading>
43+
<AccordionItemButton>
44+
{item.heading}
45+
</AccordionItemButton>
46+
</AccordionItemHeading>
47+
<AccordionItemPanel>
48+
{item.content}
49+
</AccordionItemPanel>
50+
</AccordionItem>
51+
))}
52+
</Accordion>`;
53+
54+
export const ExamplePreExpanded = `<Accordion preExpanded={['a', 'c']}>
55+
<AccordionItem uuid="a" /> // Will be expanded by default
56+
<AccordionItem uuid="b" />
57+
<AccordionItem uuid="c" /> // Will be expanded by default
58+
<AccordionItem uuid="d" />
59+
</Accordion>`;
60+
61+
export const ExampleOnChange = `<Accordion onChange={() => console.log('Hello world')}>
62+
{items.map((item) => (
63+
<AccordionItem key={item.uuid}>
64+
<AccordionItemHeading>
65+
<AccordionItemButton>
66+
{item.heading}
67+
</AccordionItemButton>
68+
</AccordionItemHeading>
69+
<AccordionItemPanel>
70+
{item.content}
71+
</AccordionItemPanel>
72+
</AccordionItem>
73+
))}
74+
</Accordion>`;
75+
76+
export const ExampleAccordionItemState = `<Accordion>
77+
<AccordionItem>
78+
<AccordionItemHeading>
79+
<AccordionItemButton>
80+
This item is
81+
<AccordionItemState>
82+
{({ expanded }) => (expanded ? 'expanded' : 'collapsed')}
83+
</AccordionItemState>
84+
</AccordionItemButton>
85+
</AccordionItemHeading>
86+
<AccordionItemPanel>
87+
<p>I am the content</p>
88+
</AccordionItemPanel>
89+
</AccordionItem>
90+
</Accordion>`;
91+
92+
export const ExampleDangerouslySetExpanded = `<Accordion>
93+
{items.map((item, i) => {
94+
const isExpanded = i < 2;
95+
96+
return (
97+
<AccordionItem
98+
key={item.heading}
99+
uuid={item.uuid}
100+
dangerouslySetExpanded={isExpanded}
101+
>
102+
<AccordionItemHeading>
103+
<AccordionItemButton>
104+
{item.heading}
105+
</AccordionItemButton>
106+
</AccordionItemHeading>
107+
<AccordionItemPanel>
108+
{item.panel}
109+
</AccordionItemPanel>
110+
</AccordionItem>
111+
);
112+
})}
113+
</Accordion>`;

demo/src/components/Code.tsx

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// tslint:disable-next-line no-implicit-dependencies no-import-side-effect
2+
import * as React from 'react';
3+
// tslint:disable-next-line no-implicit-dependencies no-import-side-effect
4+
import { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter';
5+
// tslint:disable-next-line no-implicit-dependencies no-import-side-effect no-submodule-imports
6+
import jsx from 'react-syntax-highlighter/dist/esm/languages/prism/jsx';
7+
// tslint:disable-next-line no-implicit-dependencies no-import-side-effect no-submodule-imports
8+
import prism from 'react-syntax-highlighter/dist/esm/styles/prism/prism';
9+
10+
SyntaxHighlighter.registerLanguage('jsx', jsx);
11+
12+
import {
13+
Accordion,
14+
AccordionItem,
15+
AccordionItemButton,
16+
AccordionItemHeading,
17+
AccordionItemPanel,
18+
AccordionItemState,
19+
} from '../../../src';
20+
21+
type Props = {
22+
code: string;
23+
};
24+
25+
type AccordionItemState = {
26+
expanded: boolean;
27+
};
28+
29+
const Code = ({ code }: Props) => {
30+
return (
31+
<Accordion allowZeroExpanded={true} className="code">
32+
<AccordionItem>
33+
<AccordionItemHeading>
34+
<AccordionItemButton className="code__button">
35+
<AccordionItemState>
36+
{({ expanded }: AccordionItemState) =>
37+
expanded ? 'Hide' : 'Show'
38+
}
39+
</AccordionItemState>{' '}
40+
code
41+
</AccordionItemButton>
42+
</AccordionItemHeading>
43+
<AccordionItemPanel className="code__panel">
44+
{/* tslint:disable-next-line no-unsafe-any */}
45+
<SyntaxHighlighter language="jsx" style={prism}>
46+
{code}
47+
</SyntaxHighlighter>
48+
</AccordionItemPanel>
49+
</AccordionItem>
50+
</Accordion>
51+
);
52+
};
53+
54+
export default Code;

0 commit comments

Comments
 (0)