Skip to content

Instantly share code, notes, and snippets.

View vkhv's full-sized avatar
☁️
Cloud development

Vladislav Khvostov vkhv

☁️
Cloud development
  • Cloud
View GitHub Profile
// Примеры запросов к api
// Сохранить результаты - {name: 'Stefan Butler', value: 666}
fetch('http://84.201.155.153/players', {
method: 'POST',
// Тело запроса должно содержать два поля: name и value
body: JSON.stringify(
{name: 'Stefan Butler', value: 666}
),
@vkhv
vkhv / index.haml
Created April 20, 2019 14:30
The Matrix has you.
.editor-text
.scanlines
@vkhv
vkhv / App.js
Last active June 8, 2018 06:32
styled-component-example
import React, { Component } from 'react';
import styled from 'styled-components';
const Heder = styled.div`
color: red;
`;
class App extends Component {
render() {
return (
<Heder>Hello world</Heder>
@vkhv
vkhv / index.tsx
Last active April 11, 2018 10:39
function dataprovider(url: string, text: string, cb: Function) {
cb([1, 2, 3])
}
return (
<TextInput
theme="normal"
size="m"
import * as React from 'react';
import {Decorator, PtForm, Text} from 'yamoney-guidelines';
import {RadioButton as LegoRadioButton} from 'lego-on-react';
import {ReduxFormRadioButtonProps} from './types';
/**
* Компонент radio-button для работы с Redux Form
*/
export class ReduxFormRadioButton extends React.PureComponent<ReduxFormRadioButtonProps> {
constructor(props: ReduxFormRadioButtonProps) {
Ну вот смотри есть тип c двумя полями:
type Entity = {
name: string,
id: number
}
Ты, напрмер, пишешь экшен который использует этот тип чтобы поменять существующий объект:
const editEntity = (entity: Entity): Entity => ({name: 'bazz', id: 2});
import {Button as LegoButton} from 'lego-on-react';
import * as React from 'react';
import styled from 'styled-components';
const StyledButtonWrpapper = styled.div`
& .button {
line-height: 10px;
}
`;
import {StyledLegoButton} from '../../../../components/Button';
import * as React from 'react';
import styled from 'styled-components';
const StyledButton = styled(StyledLegoButton)`
line-height: 10px;
`;
class QueuesTabContent extends React.PureComponent {
@vkhv
vkhv / Button.tsx
Last active February 26, 2018 06:48
import * as React from 'react';
import {Button as LegoButton} from 'lego-on-react';
export class StyledLegoButton extends React.Component<{className?: string}> {
render() {
return (
<LegoButton
theme="normal"
size="xs"
type="submit"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.container {
display: flex;