Skip to content

Instantly share code, notes, and snippets.

@jsmanifest
Created June 9, 2020 14:56
Show Gist options
  • Save jsmanifest/3caedc608947163cb95d4ed9493ea6ae to your computer and use it in GitHub Desktop.
Save jsmanifest/3caedc608947163cb95d4ed9493ea6ae to your computer and use it in GitHub Desktop.
function start(component) {
// Restrict it from displaying in a smaller size
if (component.style.height < 300) {
component.style['height'] = 300
}
if (component.type === 'button') {
// Give all button components a dashed teal border
component.style['border'] = '1px dashed teal'
}
if (component.type === 'input') {
if (component.inputType === 'email') {
// Uppercase every letter for email inputs
component.style.textTransform = 'uppercase'
}
}
return component
}
const component = {
type: 'div',
style: {
height: 250,
fontSize: 14,
fontWeight: 'bold',
textAlign: 'center',
},
}
const result = start(component)
console.log(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment