Skip to content

Instantly share code, notes, and snippets.

View dbismut's full-sized avatar
🏠
Working from home

David Bismut dbismut

🏠
Working from home
View GitHub Profile
// OPTION 1
// Close Icon managed by CTO, alert managed by CTO
TryOn.init({
events: {
close: () => {
window.modal.close(); // closes the popin embedding the CTO experience
}
}
});
@dbismut
dbismut / actionTypeBuilder.js
Last active January 25, 2022 09:02
React Redux Meteor middlewares
export function actionTypeBuilder(prefix) {
return {
type: actionType => `${prefix}/${actionType}`,
loading: actionType => `${actionType}/loading`,
ready: actionType => `${actionType}/ready`,
stopped: actionType => `${actionType}/stopped`,
changed: actionType => `${actionType}/changed`,
error: actionType => `${actionType}/error`,
success: actionType => `${actionType}/success`
};
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"jest": true,
"node": true
},
"globals": {},
"parser": "/Users/david/repos/useAudioPlayer/node_modules/babel-eslint/lib/index.js",
@dbismut
dbismut / Post.js
Last active April 9, 2018 22:14
Part 3 - Adding the .post-enter-started class
executeEnteringTransition = (node, done) => {
this.postStyler.set({ ...this.from, visibility: 'visible' });
node.classList.add('post-enter-started'); // add this line
/* same code */
complete: () => {
node.classList.remove('post-enter-started'); // add this line
done();
}
@dbismut
dbismut / Post.scss
Last active April 9, 2018 22:13
Part 3 - Styling the underlay so it gets a blur
.page-post .underlay {
position: fixed;
top: -10vh;
left: 0;
z-index: 0;
width: 100vw;
height: 120vh;
background-color: #fff;
transition: opacity 400ms ease;
&::before {
@dbismut
dbismut / Post.scss
Last active April 9, 2018 22:02
Part 3 - Creation of CSS rule .post-dragged
// .post-dragged rule is exactly the same
// as .post-enter
.page-post {
&.post-enter,
&.post-dragged { // add this rule
.post {
position: fixed;
overflow: hidden;
pointer-events: none;
}
@dbismut
dbismut / Post.js
Last active April 9, 2018 22:01
Part 3 - Scales the post node in render according to dragProgress
render() {
/* same code */
const { dragProgress } = this.state;
const postStyle =
dragProgress > 0
? {
transform: `scale(${1 - dragProgress * (1 - DRAG_MINIMUM_SCALE)})`,
borderRadius: dragProgress * 16
@dbismut
dbismut / Post.js
Last active April 9, 2018 21:58
Part 3 - Adding onScroll listener to prepare for the drag feature
componentWillUnmount = () => {
this.removeListeners();
};
addListeners = () => {
window.addEventListener('scroll', this.onScroll);
};
removeListeners = () => {
window.removeEventListener('scroll', this.onScroll);
@dbismut
dbismut / Post.js
Last active April 9, 2018 21:19
Part 2 - Bootstrapping the exiting transition
onExit = () => {}
executeExitingTransition = (node, done) => {
// we're going to do some work in there!
done();
}
onAddEndListener = (node, done) => {
if (!this.preview) return done();
@dbismut
dbismut / Post.scss
Last active April 9, 2018 21:09
Part 3 - Classes that will animate the underlay and close icon
.page-post {
&.post-exit,
&.post-enter {
.content,
.close,
.underlay {
opacity: 0;
}
.underlay {
transition-delay: 0;