This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const theme = new Theme() | |
bloodTheme(theme) // Applying the decorator | |
const stylesheet = theme.createStylesheet() | |
console.log(stylesheet) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "blood", | |
"header": { | |
"color": "#fff", | |
"fontStyle": "italic", | |
"fontFamily": "Roboto, sans-serif" | |
}, | |
"background": { "backgroundColor": "#C53719", "color": "#fff" }, | |
"button": { "backgroundColor": "maroon", "color": "#fff" }, | |
"color": "#fff", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function debugTheme(originalTheme) { | |
const stylesheet = originalTheme.createStylesheet() | |
console.log( | |
'%cStylesheet created:', | |
'color:green;font-weight:bold;', | |
stylesheet, | |
) | |
if (!stylesheet.primary) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import './styles.css' | |
function Navbar({ | |
items, | |
selectedItem: selectedItemProp, | |
onSelect: onSelectProp = () => {}, | |
}) { | |
const { current: isControlled } = React.useRef(selectedItemProp !== undefined) | |
const [selectedItem, setSelectedItem] = React.useState( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { useSelector, useDispatch } from 'react-redux' | |
import { Modal } from 'components/common' | |
import SigninSignup from './modalComponents/SigninSignup' | |
import { toggle } from './appModalSlice' | |
import { selectModal } from './selectors' | |
import * as modalComponents from './modalComponents' | |
function AppModal() { | |
const modal = useSelector(selectModal) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// <Some file that you will import from>.js | |
export { default as LOGOUT_PROMPT } from './LogoutPrompt' | |
export { default as CREATE_FRENCH_FRIES } from './CreateFrenchFries' | |
export { default as CREATE_MASHED_POTATOES } from './CreateMashedPotatoes' | |
export { default as DELETE_FRENCH_FRIES } from './DeleteFrenchFries' | |
export { default as DELETE_MASHED_POTATOES } from './DeleteMashedPotatoes' | |
export { default as EDIT_MASHED_POTATOES } from './EditMashedPotatoes' | |
export { default as UPDATE_PASSWORD } from './UpdatePassword' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { useSelector, useDispatch } from 'react-redux' | |
import { Modal } from 'components/common' | |
import LogoutPrompt from './modalComponents/LogoutPrompt' | |
import CreateFrenchFries from './modalComponents/CreateFrenchFries' | |
import CreateMashedPotatoes from './modalComponents/CreateMashedPotatoes' | |
import DeleteFrenchFries from './modalComponents/DeleteFrenchFries' | |
import DeleteMashedPotatoes from './modalComponents/DeleteMashedPotatoes' | |
import EditMashedPotatoes from './modalComponents/EditMashedPotatoes' | |
import UpdatePassword from './modalComponents/UpdatePassword' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Dashboard({ children }) { | |
return ( | |
<div style={{ padding: '25px 12px' }}> | |
{children} | |
</div> | |
) | |
} | |
function App() { | |
return ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function App() { | |
return ( | |
<div> | |
<MyComponent component="div" name="Ralph" gender="male" email="[email protected]"> | |
</div> | |
) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MyComponent({ component: Component = 'div', name, gender, email }) { | |
return ( | |
<Component> | |
<h1>Hi {name}</h1> | |
<div> | |
<h6>You are a {gender}</h6> | |
<small>Your email is {email}</small> | |
</div> | |
</Component> | |
) |