Skip to content

Commit

Permalink
fix: ts-standard
Browse files Browse the repository at this point in the history
  • Loading branch information
Yefee8 committed Aug 2, 2023
1 parent adf33ce commit 69ef741
Show file tree
Hide file tree
Showing 11 changed files with 241 additions and 245 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yefee-ui",
"version": "0.1.0",
"version": "0.1.2",
"author": "yefee",
"license": "ISC",
"repository": {
Expand Down
24 changes: 12 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from "react";
import ReactDOM from "react-dom";
import Button from "./lib/Button/Button";
import React from 'react'
import ReactDOM from 'react-dom'
import Button from './lib/Button/Button'

const App = () => {
return (
<div>
<Button>
Yo!
</Button>
</div>
)
};
return (
<div>
<Button>
Yo!
</Button>
</div>
)
}

ReactDOM.render(<App />, document.getElementById("root"));
ReactDOM.render(<App />, document.getElementById('root'))
50 changes: 25 additions & 25 deletions src/lib/Alert/Alert.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import React from 'react';
import './alert.css';
import React from 'react'
import './alert.css'

interface props {
children: any;
color?: "primary" | "success" | "danger" | "secondary" | "white";
width?: string | number;
height?: string | number;
style?: object;
[key: string]: any;
children: any
color?: 'primary' | 'success' | 'danger' | 'secondary' | 'white'
width?: string | number
height?: string | number
style?: object
[key: string]: any
}

export default function Alert(props: props) {
export default function Alert (props: props) {
function isItUsable () {
const { children, color, width, height, style, ...restProps } = props
return restProps
}

function isItUsable() {
let { children, color, width, height, style, ...restProps } = props;
return restProps;
}

return (
<div
style={{
width: props.width ? props.width : "",
height: props.height ? props.height : "",
...props.style
}}
className={`yefee-alert ${props.color ? props.color : 'primary'}-alert`} {...isItUsable()}>
{props.children}
</div>
);
return (
<div
style={{
width: props.width ? props.width : '',
height: props.height ? props.height : '',
...props.style
}}
className={`yefee-alert ${props.color ? props.color : 'primary'}-alert`} {...isItUsable()}
>
{props.children}
</div>
)
}
37 changes: 19 additions & 18 deletions src/lib/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import React from 'react';
import './button.css';
import React from 'react'
import './button.css'

interface props {
children: any;
type?: "rounded" | "normal" | "outlined" | "rounded-outlined";
color?: "primary" | "success" | "danger" | "secondary" | "white";
[key: string]: any;
children: any
type?: 'rounded' | 'normal' | 'outlined' | 'rounded-outlined'
color?: 'primary' | 'success' | 'danger' | 'secondary' | 'white'
[key: string]: any
}

export default function Button(props: props){
export default function Button (props: props) {
function isItUsable () {
const { children, type, color, ...restProps } = props
return restProps
}

function isItUsable() {
let { children, type, color, ...restProps } = props;
return restProps;
}

return (
<button className={`yefee-button ${props.color ? props.color : 'primary'}-button
${props.type ? props.type === "rounded-outlined" && "rounded-button outlined" || props.type : 'normal'}-button`} {...isItUsable()}>
{props.children}
</button>
);
return (
<button
className={`yefee-button ${props.color ? props.color : 'primary'}-button
${props.type ? props.type === 'rounded-outlined' && 'rounded-button outlined' || props.type : 'normal'}-button`} {...isItUsable()}
>
{props.children}
</button>
)
}
83 changes: 41 additions & 42 deletions src/lib/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,52 +1,51 @@
import React, { useEffect, useState } from 'react';
import './dialog.css';
import React, { useEffect, useState } from 'react'
import './dialog.css'

interface props {
color?: "dark" | "white";
children?: any;
show: boolean;
[key: string]: any;
color?: 'dark' | 'white'
children?: any
show: boolean
[key: string]: any
}

export default function Dialog(props: props) {
const [firstTime, setFirstTime] = useState(0);
const [animationClass, setAnimationClass] = useState('dialog-none');
export default function Dialog (props: props) {
const [firstTime, setFirstTime] = useState(0)
const [animationClass, setAnimationClass] = useState('dialog-none')

function DialogAnimationClass() {
if (props.show) {
setAnimationClass("dialog-visible");
if (firstTime !== 2) {
setFirstTime(2);
}
}

else {
if (firstTime === 0) {
setAnimationClass("dialog-none");
setFirstTime(2);
}
else {
setAnimationClass("dialog-invisible");
setTimeout(() => {
setAnimationClass("dialog-none");
}, 300)
}
}
function DialogAnimationClass () {
if (props.show) {
setAnimationClass('dialog-visible')
if (firstTime !== 2) {
setFirstTime(2)
}
} else {
if (firstTime === 0) {
setAnimationClass('dialog-none')
setFirstTime(2)
} else {
setAnimationClass('dialog-invisible')
setTimeout(() => {
setAnimationClass('dialog-none')
}, 300)
}
}
}

useEffect(() => {
DialogAnimationClass();
}, [props.show])
useEffect(() => {
DialogAnimationClass()
}, [props.show])

function isItUsable() {
let { color, children, ...restProps } = props;
return restProps;
}
function isItUsable () {
const { color, children, ...restProps } = props
return restProps
}

return (
<div className={`${props.color ? props.color : "dark"}-dialog yefee-dialog-base ${animationClass}`}
{...isItUsable()}>
{props.children}
</div>
);
return (
<div
className={`${props.color ? props.color : 'dark'}-dialog yefee-dialog-base ${animationClass}`}
{...isItUsable()}
>
{props.children}
</div>
)
}
100 changes: 50 additions & 50 deletions src/lib/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
import React, { useEffect, useState } from 'react';
import './dropdown.css';
import React, { useEffect, useState } from 'react'
import './dropdown.css'

interface props {
color?: "dark" | "white";
show: boolean;
items: {
name: string,
change: string
}[];
setter: (change: any) => void;
close: () => void;
id?: string;
[key: string]: any;
color?: 'dark' | 'white'
show: boolean
items: Array<{
name: string
change: string
}>
setter: (change: any) => void
close: () => void
id?: string
[key: string]: any
}

export default function Dropdown(props: props) {
const [showClass, setShowClass] = useState(props.show ? 'yefee-dropdown-visible' : 'yefee-dropdown-invisible')
const [firstTime, setFirstTime] = useState(0);
export default function Dropdown (props: props) {
const [showClass, setShowClass] = useState(props.show ? 'yefee-dropdown-visible' : 'yefee-dropdown-invisible')
const [firstTime, setFirstTime] = useState(0)

function isItUsable() {
let { color, show, items, ...restProps } = props;
return restProps;
}
function isItUsable () {
const { color, show, items, ...restProps } = props
return restProps
}

useEffect(() => {
if (props.show) {
setShowClass('yefee-dropdown-visible')
if (firstTime >= 0) {
setFirstTime(-1);
}
}
else {
setShowClass('yefee-dropdown-invisible');
if (firstTime === 0) {
setFirstTime(1)
}
else if (firstTime === 1) {
setFirstTime(2);
}
}
}, [props.show])
useEffect(() => {
if (props.show) {
setShowClass('yefee-dropdown-visible')
if (firstTime >= 0) {
setFirstTime(-1)
}
} else {
setShowClass('yefee-dropdown-invisible')
if (firstTime === 0) {
setFirstTime(1)
} else if (firstTime === 1) {
setFirstTime(2)
}
}
}, [props.show])

return (
<div className={`yefee-dropdown-items ${props.color ? props.color : 'dark'}-dropdown ${showClass === 'yefee-dropdown-invisible' && firstTime === 1 ? 'yefee-dropdown-first' : showClass}`} {...isItUsable()}>
{props.items.map((item) => {
return (
<div onClick={() => {
props.setter(item.change)
return props.close();
}} className="yefee-dropdown-item">
{item.name}
</div>
)
})}
</div>
);
return (
<div className={`yefee-dropdown-items ${props.color ? props.color : 'dark'}-dropdown ${showClass === 'yefee-dropdown-invisible' && firstTime === 1 ? 'yefee-dropdown-first' : showClass}`} {...isItUsable()}>
{props.items.map((item) => {
return (
<div
onClick={() => {
props.setter(item.change)
return props.close()
}} className='yefee-dropdown-item'
>
{item.name}
</div>
)
})}
</div>
)
}
30 changes: 15 additions & 15 deletions src/lib/Dropdown/DropdownBase.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import React from 'react';
import './dropdown.css';
import React from 'react'
import './dropdown.css'

interface props {
children: any;
className?: string;
[key: string]: any;
children: any
className?: string
[key: string]: any
}

export default function DropdownBase(props: props) {
function isItUsable() {
let { children, className, ...restProps } = props;
return restProps;
}
export default function DropdownBase (props: props) {
function isItUsable () {
const { children, className, ...restProps } = props
return restProps
}

return (
<div className={`yefee-dropdown-base ${props.className ? props.className : ""}`} {...isItUsable()}>
{props.children}
</div>
);
return (
<div className={`yefee-dropdown-base ${props.className ? props.className : ''}`} {...isItUsable()}>
{props.children}
</div>
)
}
Loading

0 comments on commit 69ef741

Please sign in to comment.