forked from scratchfoundation/scratch-paint
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4b85e3
commit 9163e75
Showing
9 changed files
with
155 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Button from '../button/button.jsx'; | ||
|
||
class CustomFontButton extends React.Component { | ||
constructor (props) { | ||
super(props); | ||
this.handleMouseOver = this.handleMouseOver.bind(this); | ||
} | ||
handleMouseOver () { | ||
this.props.onMouseOver(this.props.font); | ||
} | ||
render () { | ||
return ( | ||
<Button | ||
{...this.props} | ||
onMouseOver={this.handleMouseOver} | ||
> | ||
{this.props.children} | ||
</Button> | ||
); | ||
} | ||
} | ||
|
||
CustomFontButton.propTypes = { | ||
children: PropTypes.node.isRequired, | ||
font: PropTypes.string.isRequired, | ||
onMouseOver: PropTypes.func.isRequired | ||
}; | ||
|
||
export default CustomFontButton; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const SET_CUSTOM_FONTS = 'scratch-paint/tw/custom-fonts/SET_CUSTOM_FONTS'; | ||
const initialState = []; | ||
|
||
const reducer = function (state, action) { | ||
if (typeof state === 'undefined') state = initialState; | ||
switch (action.type) { | ||
case SET_CUSTOM_FONTS: | ||
return action.fonts; | ||
default: | ||
return state; | ||
} | ||
}; | ||
|
||
const setCustomFonts = fonts => ({ | ||
type: SET_CUSTOM_FONTS, | ||
fonts | ||
}); | ||
|
||
export { | ||
reducer as default, | ||
setCustomFonts | ||
}; |
This file contains 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