Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b9d8a88
Creates the Checkbox Componet.
Vesta-Nassone Apr 8, 2021
195fd34
Implements the Checkbox Component.
Vesta-Nassone Apr 8, 2021
c471b7d
Exports the Checkbox Component.
Vesta-Nassone Apr 8, 2021
c7d4067
Creates a Checkbox story in Storybook.
Vesta-Nassone Apr 8, 2021
9258b08
Modifies the Checkbox story.
Vesta-Nassone Apr 8, 2021
fc74b25
Adds the Checkbox states to Storybook.
Vesta-Nassone Apr 8, 2021
fd82472
Adds state to checkbox Component.
Vesta-Nassone Apr 8, 2021
52fc56e
Pulls changes from TeaxtArea.
Vesta-Nassone Apr 8, 2021
b7de7e2
Adds Captions to the Checkbox Stories.
Vesta-Nassone Apr 8, 2021
ce30cbc
Pulls the refence changes from TextArea
Vesta-Nassone Apr 8, 2021
8d58f73
Fixes the <li> descendent issue.
Vesta-Nassone Apr 8, 2021
49dc11c
Fixes the Checked state.
Vesta-Nassone Apr 8, 2021
50cbed3
Fixes the clip-rule and fill-rule issue in LoadingSpinner.
Vesta-Nassone Apr 8, 2021
db96cc0
Adds handleChangeFunction to Checkbox
Vesta-Nassone Apr 8, 2021
706d63f
Adds an id to Checkbox for Testing.
Vesta-Nassone Apr 8, 2021
82fed2d
Export Checkbox.
Vesta-Nassone Apr 8, 2021
4ba4063
Tests the Checkbox component for the correct classname.
Vesta-Nassone Apr 8, 2021
a1870c4
Adds a data-testid to checkbox for testing.
Vesta-Nassone Apr 8, 2021
45c4c3c
Checks the Checkbox component for the correct toggle state.
Vesta-Nassone Apr 8, 2021
32dda85
Rectifies the toggle Test for Checkbox.
Vesta-Nassone Apr 8, 2021
34d39ab
Adds an empty string to className as default.
Vesta-Nassone Apr 8, 2021
0e00f1d
Removes the variant from Checkbox.
Vesta-Nassone Apr 8, 2021
b273c6a
Adds rounded adges to Text area.
Vesta-Nassone Apr 9, 2021
a002144
Renames input stories.
Vesta-Nassone Apr 9, 2021
c74a5cc
Creates a Tag Component.
Vesta-Nassone Apr 9, 2021
3cecbea
Exports the Tag COmponent.
Vesta-Nassone Apr 9, 2021
a2218b8
Implements the Tag Component.
Vesta-Nassone Apr 9, 2021
f2ca2a5
Creates a Tag Story in Storybook.
Vesta-Nassone Apr 9, 2021
fd91bf8
Adds a variant to the Tag.
Vesta-Nassone Apr 9, 2021
41aa35d
Populates the Tag stories with the varinats.
Vesta-Nassone Apr 9, 2021
1ed6aff
Removes the SVG icon.
Vesta-Nassone Apr 9, 2021
9e4e294
Adjusts the yellow color and align items to div.
Vesta-Nassone Apr 9, 2021
dcf8475
Adds active and inactive variants.
Vesta-Nassone Apr 9, 2021
40fa682
Adds UnknownTag variant.
Vesta-Nassone Apr 9, 2021
6d33079
Adds UnknownTag variant.
Vesta-Nassone Apr 9, 2021
9afba56
Attempts the implement the count tag loigc.
Vesta-Nassone Apr 9, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions assets/icons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const LoadingSpinner: FC = () => (
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
fillRule="evenodd"
clipRule="evenodd"
d="M18.65 8.35L15.86 11.14C15.54 11.46 15.76 12 16.21 12H18C18 15.31 15.31 18 12 18C11.21 18 10.44 17.85 9.75003 17.56C9.39003 17.41 8.98003 17.52 8.71003 17.79C8.20003 18.3 8.38003 19.16 9.05003 19.43C9.96003 19.8 10.96 20 12 20C16.42 20 20 16.42 20 12H21.79C22.24 12 22.46 11.46 22.14 11.15L19.35 8.36C19.16 8.16 18.84 8.16 18.65 8.35V8.35ZM6.00003 12C6.00003 8.69 8.69003 6 12 6C12.79 6 13.56 6.15 14.25 6.44C14.61 6.59 15.02 6.48 15.29 6.21C15.8 5.7 15.62 4.84 14.95 4.57C14.04 4.2 13.04 4 12 4C7.58003 4 4.00003 7.58 4.00003 12H2.21003C1.76003 12 1.54003 12.54 1.86003 12.85L4.65003 15.64C4.85003 15.84 5.16003 15.84 5.36003 15.64L8.15003 12.85C8.46003 12.54 8.24003 12 7.79003 12H6.00003Z"
fill="white"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const ImageLoading = styled.div`
`

const Button: FC<Props> = ({
className,
className='',
onClick,
children,
disabled,
Expand Down
2 changes: 2 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export { default as Option } from './inputs/dropdown/Dropdown'
export { default as DatePicker } from './inputs/datePicker/DatePicker'
export { default as TextArea } from './inputs/textArea/TextArea'
export { default as Typography } from './typography/Typography'
export { default as Checkbox } from './inputs/checkbox/Checkbox'
export { default as HeadingOne } from './typography/HeadingOne'
export { default as HeadingTwo } from './typography/HeadingTwo'
export { default as HeadingThree } from './typography/HeadingThree'
Expand All @@ -13,3 +14,4 @@ export { default as HeadingSix } from './typography/HeadingSix'
export { default as BodyText } from './typography/BodyText'
export { default as Link } from './typography/Link'
export { default as Button } from './buttons/Button'
export { default as Tag } from './labels/Tag'
34 changes: 34 additions & 0 deletions src/inputs/checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React, { ChangeEventHandler, FC, InputHTMLAttributes } from 'react'
import '../../index.css'

export interface Props extends InputHTMLAttributes<HTMLInputElement> {
className?: string
onChange?: ChangeEventHandler,
children?: any
disabled?: boolean,
isChecked?: boolean
}

const Checkbox: FC<Props> = ({
className = '',
onChange,
children,
disabled = false,
isChecked = false
}: Props) => {
return (
<label className="inline-flex items-center">
<input
className={` ${className} form-checkbox h-4 w-4`}
onChange={onChange}
type="checkbox"
disabled={disabled}
checked={isChecked}
data-testid="checkbox"
/>
<span className="ml-2">{children}</span>
</label>
)
}

export default Checkbox;
5 changes: 5 additions & 0 deletions src/inputs/checkbox/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Checkbox from './Checkbox'

export { Checkbox }

export default { Checkbox }
2 changes: 1 addition & 1 deletion src/inputs/datePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface Props {
}


const DatePicker: FC<Props> = ({ className, onChange, variant = "datePicker", format = "DD/MM/YYYY", value }: Props) => (
const DatePicker: FC<Props> = ({ className='', onChange, variant = "datePicker", format = "DD/MM/YYYY", value }: Props) => (
<Space
className={`${className}`}
direction="vertical"
Expand Down
2 changes: 1 addition & 1 deletion src/inputs/dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface Props {
placeholder?: string
}

const Dropdown: FC<Props> = ({ className, children, onBlur, onChange, onFocus, onSearch }: Props) => (
const Dropdown: FC<Props> = ({ className='', children, onBlur, onChange, onFocus, onSearch }: Props) => (
<Select
virtual={false}
defaultValue="Select an Item"
Expand Down
5 changes: 3 additions & 2 deletions src/inputs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import Input from './input/Input'
import Dropdown, { Option } from './dropdown/Dropdown'
import DatePicker from './datePicker/DatePicker'
import TextArea from './textArea/TextArea'
import Checkbox from './checkbox/Checkbox'

export { Input, Dropdown, Option, DatePicker, TextArea }
export { Input, Dropdown, Option, DatePicker, TextArea, Checkbox }

export default { Input, Dropdown, Option, DatePicker, TextArea }
export default { Input, Dropdown, Option, DatePicker, TextArea, Checkbox }

2 changes: 1 addition & 1 deletion src/inputs/input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface Props extends InputHTMLAttributes<HTMLInputElement> {
// `

const Input: FC<Props> = ({
className,
className='',
onChange,
variant = "text",
...rest
Expand Down
4 changes: 2 additions & 2 deletions src/inputs/textArea/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ export interface Props extends InputHTMLAttributes<HTMLInputElement> {
}

const TextArea: FC<Props> = ({
className,
className='',
onChange,
value,
placeholder
}: Props) => {
return (
<textarea
className={` ${className} border border-grey font-poppins py-12 px-16 rounded-sm focus:outline-none `}
className={`${className} border border-grey font-poppins py-12 px-16 rounded-sm focus:outline-none rounded-lg`}
onChange={onChange}
value={value}
placeholder={placeholder}
Expand Down
64 changes: 64 additions & 0 deletions src/labels/Tag.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React, { FC } from 'react'
import '../index.css'

export interface Props {
className?: string
children?: any
variant: string,
count?: number
isCount?: boolean
}

const Tag: FC<Props> = ({
className = '',
children,
variant,
isCount = false,
count = 0
}: Props) => {

const types: any = {
SuccessTag: {
backgroundColor: 'bg-green-300',
textUtils: 'text-white font-poppins rounded-md',
},
WarningTag: {
backgroundColor: 'bg-yellow-500',
textUtils: 'text-white font-poppins rounded-md',
},
DangerTag: {
backgroundColor: 'bg-red-300',
textUtils: 'text-white font-poppins rounded-md',
},
ActiveTag: {
backgroundColor: 'bg-green-300',
textUtils: 'text-white font-poppins rounded-md',
},
InactiveTag: {
borderColor: 'border border-solid border-red-200',
backgroundColor: 'bg-transparent',
textUtils: 'text-gray-300 font-poppins rounded-md',
},
UnknownTag: {
backgroundColor: 'bg-orange-400',
textUtils: 'text-gray-300 font-poppins rounded-full',
},
CountTag: {
backgroundColor: 'bg-red-200',
textUtils: 'text-white font-poppins rounded-lg',
}
}

const classNames: string = Object.values(types[variant]).join(' ')

return (
<div className={`${className} ${classNames} text-sm inline-flex items-center leading-sm px-3 py-1`}>
{isCount ? (
count
) : (
children
)}
</div>
)
}
export default Tag;
5 changes: 5 additions & 0 deletions src/labels/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Tag from './Tag'

export { Tag }

export default { Tag }
2 changes: 1 addition & 1 deletion src/typography/BodyText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface Props {
children: any
}

const BodyText: FC<Props> = ({ children, className }: Props) => (
const BodyText: FC<Props> = ({ children, className='' }: Props) => (
<p className={` ${className} text-black text-base`}>{children}</p>
)

Expand Down
2 changes: 1 addition & 1 deletion src/typography/HeadingFive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface Props {
children: any
}

const HeadingFive: FC<Props> = ({ children, className }: Props) => (
const HeadingFive: FC<Props> = ({ children, className='' }: Props) => (
<h5 className={` ${className} text-2xl text-black font-poppins`}>
{children}
</h5>
Expand Down
2 changes: 1 addition & 1 deletion src/typography/HeadingFour.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface Props {
className: string
children: any
}
const HeadingFour: FC<Props> = ({ children, className }: Props) => (
const HeadingFour: FC<Props> = ({ children, className='' }: Props) => (
<h4 className={` ${className} text-3xl text-black font-poppins`}>
{children}
</h4>
Expand Down
2 changes: 1 addition & 1 deletion src/typography/HeadingOne.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface Props {
children: any
}

const HeadingOne: FC<Props> = ({ children, className }: Props) => (
const HeadingOne: FC<Props> = ({ children, className='' }: Props) => (
<h1 className={` ${className} text-6xl text-black font-poppins`}>
{children}
</h1>
Expand Down
2 changes: 1 addition & 1 deletion src/typography/HeadingSix.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface Props {
children: any
}

const HeadingSix: FC<Props> = ({ children, className }: Props) => (
const HeadingSix: FC<Props> = ({ children, className='' }: Props) => (
<h6 className={` ${className} text-1xl text-black font-poppins`}>
{children}
</h6>
Expand Down
2 changes: 1 addition & 1 deletion src/typography/HeadingThree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface Props {
className: string
children: any
}
const HeadingThree: FC<Props> = ({ children, className }: Props) => (
const HeadingThree: FC<Props> = ({ children, className='' }: Props) => (
<h3 className={` ${className} text-4xl text-black font-poppins`}>
{children}
</h3>
Expand Down
2 changes: 1 addition & 1 deletion src/typography/HeadingTwo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface Props {
children: any
}

const HeadingTwo: FC<Props> = ({ children, className }: Props) => (
const HeadingTwo: FC<Props> = ({ children, className='' }: Props) => (
<h2 className={` ${className} text-5xl text-black font-poppins`}>
{children}
</h2>
Expand Down
2 changes: 1 addition & 1 deletion src/typography/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface Props {
children: any
url: string
}
const Link: FC<Props> = ({ children, className, url }: Props) => (
const Link: FC<Props> = ({ children, className='', url }: Props) => (
<a
href={url}
className={` ${className} text-black font-poppins no-underline hover:underline hover:text-blue-400`}
Expand Down
2 changes: 1 addition & 1 deletion src/typography/Typography.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface Props {
}
const Typography: FC<Props> = ({
variant,
className,
className='',
children,
href,
}: Props) => {
Expand Down
63 changes: 54 additions & 9 deletions stories/Inputs.stories.tsx → stories/inputs.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { Input, Dropdown, DatePicker, TextArea } from '../src/inputs'
import { Input, Dropdown, DatePicker, TextArea, Checkbox } from '../src/inputs'
import { Option } from '../src/inputs/dropdown'
export default {
title: 'Input/Inputs',
Expand All @@ -11,6 +11,16 @@ function onChange(value: any) {
console.log(`selected ${value}`)
}

function handleChange(isChecked: any) {
isChecked = !isChecked;
if ((document.getElementById('checkbox') as HTMLInputElement).checked) {
isChecked = !isChecked;
console.log("uchecked")
} else {
console.log("checked");
}
}

function onBlur() {
console.log('blur')
}
Expand All @@ -25,17 +35,17 @@ function onSearch(val: any) {
export const Default = () =>
<ul>
<li>
<li>
<p>
<b>Text Input</b>
</li>
</p>
<Input
placeholder="Type here"
onChange={onChange} />
</li><br />
<li>
<li>
<p>
<b>Number Input</b>
</li>
</p>
<Input
onChange={onChange}
variant="number"
Expand Down Expand Up @@ -63,17 +73,17 @@ export const Dropdown_Menu = () => (
export const Date_Picker = () => (
<ul>
<li>
<li>
<p>
<b>Date Picker</b>
</li>
</p>
<DatePicker
onChange={onChange}>
</DatePicker>
</li><br />
<li>
<li>
<p>
<b>Range Picker</b>
</li>
</p>
<DatePicker
onChange={onChange}
variant="rangePicker">
Expand All @@ -89,3 +99,38 @@ export const Text_Area = () =>
placeholder="Enter Text here.." />
</div>

export const CheckBox = () =>
<ul>
<li>
<p>
<b>Unchecked</b>
</p>
<Checkbox
onChange={handleChange}
>
Placeholder
</Checkbox>
</li><br />
<li>
<p>
<b>Checked</b>
</p>
<Checkbox
onChange={handleChange}
isChecked={true}>
Placeholder
</Checkbox>
</li><br />
<li>
<p>
<b>Disabled</b>
</p>
<Checkbox
disabled={true}>
Placeholder
</Checkbox>
</li>
</ul>



Loading