diff --git a/packages/accordion/examples/index.story.js b/packages/accordion/examples/index.story.js index 9ccbe40a2..dd7c0118e 100644 --- a/packages/accordion/examples/index.story.js +++ b/packages/accordion/examples/index.story.js @@ -8,6 +8,7 @@ export { Example as ReadOnly } from "./read-only.example.js"; export { Example as StyledTS } from "./styled.example.tsx"; export { Example as WithArbitraryElements } from "./with-arbitrary-elements.example.js"; export { Example as WithArrows } from "./with-arrows.example.js"; +export { Example as WithIndexProp } from "./with-index-prop.example.js"; export { Example as WithUseaccordioncontextHookTS } from "./with-useaccordioncontext-hook.example.tsx"; export default { diff --git a/packages/accordion/examples/styled.example.tsx b/packages/accordion/examples/styled.example.tsx index af878516a..48b37f41f 100644 --- a/packages/accordion/examples/styled.example.tsx +++ b/packages/accordion/examples/styled.example.tsx @@ -86,8 +86,8 @@ const StyledButton = styled(AccordionButton)` box-shadow: none; padding: 0.375em 0.5em; - &[data-disabled] { - color: rgba(255, 255, 255, 0.5); + &[disabled] { + opacity: 0.5; } &:focus { diff --git a/packages/accordion/examples/with-index-prop.example.js b/packages/accordion/examples/with-index-prop.example.js new file mode 100644 index 000000000..31493088b --- /dev/null +++ b/packages/accordion/examples/with-index-prop.example.js @@ -0,0 +1,117 @@ +import * as React from "react"; +import { + Accordion, + AccordionItem, + AccordionButton, + AccordionPanel, +} from "@reach/accordion"; +import { action } from "@storybook/addon-actions"; +import "@reach/accordion/styles.css"; + +let name = "With index prop on items"; + +function Example() { + let [items, setItems] = React.useState([ + { + button: "Item 1", + panel: `Ante rhoncus facilisis iaculis nostra faucibus vehicula ac consectetur pretium, lacus nunc consequat id viverra facilisi ligula eleifend, congue gravida malesuada proin scelerisque luctus est convallis.`, + }, + { + button: "Item 2", + panel: `Exercitationem incidunt eius nobis tempore fugiat laboriosam odio inventore! Molestias hic aliquid veniam id, quia, recusandae tenetur magni error et eos perferendis. Deserunt eius voluptate doloremque!`, + disabled: true, + }, + { + button: "Item 3", + panel: `At, quas? Alias impedit, facilis voluptatibus commodi laboriosam sunt explicabo harum, nulla aliquid autem atque asperiores veniam obcaecati ipsum, ad recusandae architecto.`, + }, + ]); + return ( +