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

feat(code): add code tab content to modal #1126

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b909df8
feat(code): add usage content to modal
asudoh Apr 23, 2020
17979b9
chore(modal): change header level
asudoh Apr 24, 2020
e13cc53
chore(modal): ensure live demo is at the top
asudoh Apr 24, 2020
8ce274b
chore(modal): remove inline code from header
asudoh Apr 24, 2020
c3778b4
chore(modal): move modal variant explanation to the top
asudoh Apr 24, 2020
c2c8cc7
chore(modal): bring in knobs to live demos
asudoh Apr 27, 2020
0a050b5
chore(modal): callout fixes
asudoh Apr 28, 2020
b038905
Merge branch 'master' into modal-code
andreancardona Apr 28, 2020
80c0ff4
chore(modal): update upon review
asudoh Apr 30, 2020
c655ed5
Merge branch 'master' into modal-code
asudoh May 15, 2020
36d7743
Merge branch 'master' into modal-code
andreancardona May 19, 2020
da27e5a
Merge branch 'master' into modal-code
emyarod May 22, 2020
e5f5138
convert h3s to h2s
emyarod May 22, 2020
bbc818f
add pagedescription
emyarod May 22, 2020
76f1094
add feedback section
emyarod May 22, 2020
6a97f42
add table of contents
emyarod May 22, 2020
d4b24cd
add modal prop table
emyarod May 22, 2020
f74a38e
add line breaks and h4s
emyarod May 22, 2020
5585316
Merge branch 'master' into modal-code
emyarod May 22, 2020
c15b302
content fixes
emyarod May 26, 2020
9e67342
Merge branch 'master' into modal-code
emyarod May 26, 2020
1be148a
Merge remote-tracking branch 'upstream/master' into HEAD
emyarod Jun 4, 2020
0fec8b1
fix(modal): reference usage tab demo
emyarod Jun 4, 2020
eeea942
Merge branch 'master' into modal-code
asudoh Jun 6, 2020
5efa345
Merge branch 'master' into modal-code
alisonjoseph Jun 9, 2020
f3801ac
Merge branch 'master' into modal-code
janchild Jun 11, 2020
bf73a95
Merge branch 'master' into modal-code
Jun 11, 2020
d5cbb98
Merge branch 'master' into modal-code
alisonjoseph Jun 23, 2020
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
2 changes: 1 addition & 1 deletion src/components/ComponentDemo/KnobContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ const KnobContainer = ({ knobs, code, setCode, initialCode, variantId }) => {
}

knobs[component].forEach((knob) => {
if (fullComponent.props[knob].type) {
if (fullComponent.props[knob]?.type) {
requestedProps[knob] = fullComponent.props[knob];
} else {
console.error(
Expand Down
35 changes: 35 additions & 0 deletions src/components/ModalStateManager/ModalStateManager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import PropTypes from 'prop-types';
import React, { useState } from 'react';
import ReactDOM from 'react-dom';

/**
* Simple state manager for modals.
*/
const ModalStateManager = ({
renderLauncher: LauncherContent,
children: ModalContent,
}) => {
const [open, setOpen] = useState(false);
return (
<>
{!ModalContent || typeof document === 'undefined'
? null
: ReactDOM.createPortal(
<ModalContent open={open} setOpen={setOpen} />,
document.body
)}
{LauncherContent && <LauncherContent open={open} setOpen={setOpen} />}
</>
);
};

ModalStateManager.propTypes = {
children: PropTypes.elementType,

/**
* The component to render the launcher UI.
*/
renderLauncher: PropTypes.elementType,
};

export default ModalStateManager;
1 change: 1 addition & 0 deletions src/components/ModalStateManager/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './ModalStateManager';
Loading