1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-10-29 12:26:09 +01:00

Define typescript type for placeholders

This commit is contained in:
Phuoc Nguyen
2019-11-24 23:18:12 +07:00
parent 642e179699
commit 154a61de91
11 changed files with 50 additions and 14 deletions

View File

@@ -2,7 +2,13 @@ import React from 'react';
import random from '../helpers/random';
const Block = ({ justify = 'start', numberOfBlocks = 1, blockHeight = 4 }) => {
interface BlockProps {
blockHeight?: number;
justify?: string;
numberOfBlocks?: number;
}
const Block: React.FC<BlockProps> = ({ justify = 'start', numberOfBlocks = 1, blockHeight = 4 }) => {
return (
<div className={`flex flex-wrap w-100 justify-${justify}`}>
{

View File

@@ -1,8 +1,13 @@
import React, { useState } from 'react';
import React, { useState, ReactNode } from 'react';
import SampleCode from '../components/SampleCode';
const BrowserFrame = ({ content, source }) => {
interface BrowserFrameProps {
content: ReactNode;
source: string;
}
const BrowserFrame: React.FC<BrowserFrameProps> = ({ content, source }) => {
const [isContentActive, setContentActive] = useState(true);
const flip = () => setContentActive(isActive => !isActive);

View File

@@ -1,6 +1,10 @@
import React from 'react';
const Circle = ({ size = 16 }) => {
interface CircleProps {
size?: number;
}
const Circle: React.FC<CircleProps> = ({ size = 16 }) => {
return (
<div
className="bg-black-30 br-pill"

View File

@@ -1,6 +1,6 @@
import React from 'react';
const Frame = ({ children }) => {
const Frame: React.FC<{}> = ({ children }) => {
return (
<div
className="ba b--black-30 br2"

View File

@@ -1,6 +1,6 @@
import React from 'react';
const Line = () => {
const Line: React.FC<{}> = () => {
return (
<div
className="w-100 bg-black-30"

View File

@@ -1,6 +1,10 @@
import React from 'react';
const Rectangle = ({ height = 8 }) => {
interface RectangleProps {
height?: number;
}
const Rectangle: React.FC<RectangleProps> = ({ height = 8 }) => {
return (
<div
className="w-100 bg-black-30 br1"

View File

@@ -1,6 +1,10 @@
import React from 'react';
const Square = ({ size = 8 }) => {
interface SquareProps {
size?: number;
}
const Square: React.FC<SquareProps> = ({ size = 8 }) => {
return (
<div className="w-100 h-100 bg-black-30 br2" />
);

View File

@@ -1,6 +1,11 @@
import React from 'react';
const Triangle = ({ size = 16, corner = 'tl' }) => {
interface TriangleProps {
corner?: string;
size?: number;
}
const Triangle: React.FC<TriangleProps> = ({ size = 16, corner = 'tl' }) => {
let bw = '';
let bc = '';
switch (corner) {

View File

@@ -1,6 +1,6 @@
import React from 'react';
const VerticalLine = () => {
const VerticalLine: React.FC<{}> = () => {
return (
<div
className="h-100 bg-black-30"