📁 Changed TDrive root folder (#16)

📁 Changed TDrive root folder
This commit is contained in:
Montassar Ghanmy
2023-04-11 10:04:29 +01:00
committed by GitHub
parent 3b3f67af07
commit e0615fa867
10548 changed files with 48 additions and 48 deletions
@@ -0,0 +1,74 @@
/* eslint-disable react/prop-types */
import React from 'react';
import Loader from 'components/loader/loader.jsx';
import Button from './button.jsx';
import './buttons.scss';
export default class ButtonWithTimeout extends React.Component {
/*
props = {
loading : boolean
value : text in button
loadingTimeout : time before show loading
disabled
onClick
style
className
}
*/
constructor() {
super();
this.state = {
showLoader: false,
};
this.timeout = '';
}
componentWillUnmount() {
clearTimeout(this.timeout);
}
componentDidUpdate(prevProps) {
// eslint-disable-next-line @typescript-eslint/no-this-alias
var that = this;
if (prevProps.loading && !this.props.loading) {
if (this.state.showLoader) {
this.setState({ showLoader: false });
}
clearTimeout(this.timeout);
} else if (!prevProps.loading && this.props.loading) {
this.timeout = setTimeout(function () {
that.setState({ showLoader: true });
}, this.props.loadingTimeout || 2000);
}
}
render() {
return (
<div
className={'buttonWithTimeout_container ' + (this.state.showLoader ? 'is_loading ' : '')}
>
<Button
id={this.props.id}
refButton={node => (this.input = node)}
type="button"
style={this.props.style}
medium={this.props.medium}
small={this.props.small}
big={this.props.big}
disabled={this.props.disabled}
className={
'buttonWithTimeout ' +
(this.props.disabled ? 'buttonWithTimeoutDisabled' : '') +
' ' +
(this.props.className ? this.props.className : '')
}
onClick={this.props.onClick}
>
{this.props.value}
</Button>
<div className="loaderContainer">
{this.state.showLoader && <Loader className="loader" color="#FFF" />}
</div>
</div>
);
}
}
+40
View File
@@ -0,0 +1,40 @@
/* eslint-disable react/prop-types */
import React from 'react';
import './buttons.scss';
export default class Button extends React.Component {
render() {
var className = this.props.className || '';
if (this.props.big) {
className += ' big ';
}
if (this.props.medium) {
className += ' medium ';
}
if (this.props.small) {
className += ' small ';
}
if (
className.indexOf('medium') === className.indexOf('small') &&
className.indexOf('big') === className.indexOf('small') &&
className.indexOf('big') < 0
) {
className += ' small';
}
return (
<button
ref={this.props.refButton}
{...this.props}
className={'button no-tw ' + className}
onClick={evt => {
evt.target.blur();
this.props.onClick && this.props.onClick(evt);
}}
>
{this.props.value || this.props.children}
</button>
);
}
}
+185
View File
@@ -0,0 +1,185 @@
.buttonWithTimeout_container {
position: relative;
pointer-events: none;
& > * {
pointer-events: all;
}
.buttonWithTimeout {
padding: 0px 35px;
transition: padding 0.5s;
}
.loaderContainer {
color: #fff;
top: 0px;
right: 8px;
position: absolute;
display: inline-block;
transition: opacity 0.5s;
opacity: 0;
height: 100%;
align-items: center;
display: inline-flex;
.loader {
width: 30px;
height: 30px;
}
}
&.is_loading {
.buttonWithTimeout {
padding-right: 45px;
padding-left: 25px;
}
.loaderContainer {
opacity: 1;
}
}
}
.button, .button.no-tw {
background-color: var(--primary);
color: var(--white);
font-weight: 500;
border: 0px;
border-radius: var(--border-radius-base);
display: inline-block;
vertical-align: middle;
cursor: pointer;
&:hover {
background-color: var(--primary-hover);
}
&:active {
background-color: var(--primary);
}
&:focus {
outline: none;
}
&.disabled,
&:disabled {
background-color: var(--primary-background);
pointer-events: none;
}
&.small {
height: 32px;
line-height: 32px;
padding: 0px 8px;
font-size: 14px;
}
&.medium {
height: 40px;
line-height: 40px;
padding: 0px 12px;
font-size: 16px;
}
&.big {
height: 64px;
font-size: 18px;
line-height: 64px;
padding: 0px 24px;
}
&.secondary {
background: #807f8a;
color: var(--white);
&:hover {
background: #706f79;
}
&:active {
background: #696871;
}
&.disabled,
&:disabled {
background: #bcbcc2;
}
}
&.danger {
background: #ff1020;
color: var(--white);
&:hover {
background: #f00010;
}
&:active {
background: #d80000;
}
&.disabled,
&:disabled {
background: #ffa0a0;
}
}
&.secondary-light {
background-color: var(--grey-light);
color: var(--black);
&:hover,
&:active {
opacity: 0.9;
}
&.disabled,
&:disabled {
background-color: var(--grey-background);
color: var(--grey-dark);
}
}
&.primary-text {
background: transparent;
color: var(--primary);
font-size: 12px;
padding: 0 2px;
.m-icon-small {
font-size: 14px !important;
&:before {
margin: 0px;
}
}
&.disabled,
&:disabled {
color: var(--primary-background);
}
&:hover {
color: var(--primary-hover);
// background-color: var(--primary-background);
}
&:active {
// background-color: var(--primary-background);
}
}
&.secondary-text {
background: transparent;
color: var(--grey-dark);
font-size: 12px;
padding: 0 2px;
.m-icon-small {
font-size: 14px !important;
&:before {
margin: 0px;
}
}
&.disabled,
&:disabled {
color: var(--primary-background);
}
&:hover {
color: var(--black);
//background-color: var(--grey-background);
}
&:active {
color: var(--black);
}
}
.m-icon-small {
height: 100%;
}
}