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
type Template<T> = (args: T) => string; | |
export function makeJadeTransitionShim<T>(jadeTemplate: Template<T>, Component: React.ComponentType<T>): Template<T> { | |
return (args: T) => { | |
const jadeResult = jadeTemplate(args); | |
const reactResult = ReactDOMServer.renderToStaticMarkup(<Component {...args} />); | |
assert(jadeResult === reactResult, 'Results not equal!'); | |
return jadeResult; | |
}; | |
} |
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 ActiveEnzymeJadeTemplate from 'toolbar/templates/activeenzyme.jade'; | |
import {makeJadeTransitionShim} from 'util/makeJadeTransitionShim'; | |
export interface ActiveEnzymeProps { | |
} | |
function ActiveEnzyme({}: ActiveEnzymeProps): JSX.Element { | |
return <span>TODO</span>; | |
} | |
export default makeJadeTransitionShim<ActiveEnzymeProps>(ActiveEnzymeJadeTemplate, ActiveEnzyme); |
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 ActiveEnzyme({}: ActiveEnzymeProps): JSX.Element { | |
return ( | |
<> | |
<td className="mono">Acc65I</td> | |
<td> | |
<div style="background-color: #F58A5E;" className="swatch" /> | |
</td> | |
</> | |
); | |
} |
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
export interface ActiveEnzymeProps { | |
color: string; | |
name: string; | |
} | |
function ActiveEnzyme({color, name}: ActiveEnzymeProps): JSX.Element { | |
return ( | |
<> | |
<td className="mono">{name}</td> | |
<td> | |
<div style={{backgroundColor: color}} className="swatch" /> |
OlderNewer