Skip to content

Instantly share code, notes, and snippets.

View blvdmitry's full-sized avatar
🍌
Working on Design Systems

Dmitry Belyaev blvdmitry

🍌
Working on Design Systems
View GitHub Profile
@blvdmitry
blvdmitry / index.html
Created August 21, 2017 16:28
Margin example 1
<style>
.route-header { margin-bottom: 5px; }
.route-content { margin: 20px; }
</style>
// Route margin wrapping a component
<div class="route-header">
<div class="component1"></div>
</div>
@blvdmitry
blvdmitry / index.html
Last active August 21, 2017 17:00
Margin example 2
<style>
.mb5 { margin-bottom: 5px; }
.m20 { margin: 20px; }
</style>
// Route margin wrapping a component
<div class="mb5">
<div class="component1"></div>
</div>
@blvdmitry
blvdmitry / Group.jsx
Created August 21, 2017 16:59
Margin example 3
import React from 'react';
import c from 'classnames';
import injectSheet from 'react-jss';
import s from './styles';
class Group extends React.PureComponent {
render() {
const { children = [], inline, classes, className, small } = this.props;
const rootClassNames = c(
classes.group,
import React from "react"
import { configure } from "@storybook/react";
import "../src/styles.scss"
const req = require.context("../src", true, /.*\.(stories|story).(js|tsx)$/)
function loadStories() {
req.keys().forEach(filename => req(filename))
}
@blvdmitry
blvdmitry / tooltip
Last active December 26, 2017 13:10
tooltip
// @flow
import * as React from 'react';
import { connect } from 'react-redux';
import { Gateway } from 'react-gateway';
import get from 'lodash/get';
import cssVars from 'sj/css/variables/animations.scss';
import { hideModal, hideModalWithoutNavigation, showModal, addModal, removeModal } from 'sj/actions/modalActions';
import { MODAL_QUERY_PARAM, MODAL_GATEWAY_NAME } from 'sj/constants/modals';
import ModalManagerHolder from '../ModalManagerHolder/ModalManagerHolder';
import React from 'react';
import { connect } from 'react-redux';
import { addForm, removeForm } from 'ducks/forms/forms.actions';
class Form extends React.PureComponent {
componentWillMount() {
const { dispatch, id } = this.props;
dispatch(addForm({ formId: id }));
}
const properties: Array<ControlApi> = [{
type: 'text',
propertyName: 'textProperty',
defaultValue: 'some text',
}, {
type: 'number',
propertyName: 'numberProperty',
defaultValue: 2,
}, {
type: 'boolean',
class Popover extends React.PureComponent {
state = {
active: false,
visible: false
}
componentDidMount() {
if (this.props.active) {
this.show();
}
@blvdmitry
blvdmitry / Dialog.story.tsx
Created April 27, 2019 15:36
Dialog implementation with hooks
import React from 'react';
import { storiesOf } from '@storybook/react';
import Button from 'components/Button';
import Dialog from 'components/Dialog';
import DialogProvider from 'components/Dialog/DialogProvider';
const Story = (props: { position?: 'right' }) => {
const modalId = 'testModal';
const { show } = Dialog.use(modalId);
export const isRTL = () => !!document.querySelector('[dir=rtl]');
export const isLTR = () => !isRTL();
let cachedScrollType;
const getScrollType = () => {
if (cachedScrollType) return cachedScrollType;
const dummy = window.document.createElement('div');