replaced all css w/ tailwind css

This commit is contained in:
Niklas 2021-08-17 15:39:45 +02:00
parent effa93c182
commit ecffd9e9fe
10 changed files with 33 additions and 81 deletions

View File

@ -1,5 +0,0 @@
.imageOpenerImage{
display: block;
margin-left: auto;
margin-right: auto;
}

View File

@ -10,8 +10,8 @@ const Breadcrum: React.FC<Props> = (props) => {
const parts = props.path.split("/").filter(e=>e.length > 0) const parts = props.path.split("/").filter(e=>e.length > 0)
return ( return (
<ul className="breadcrumb"> <ul>
<li className="breadcrumb-item"> <li className="inline mr-1">
<a onClick={()=>{ <a onClick={()=>{
props.onDirClick?.("/") props.onDirClick?.("/")
}}> }}>
@ -19,13 +19,15 @@ const Breadcrum: React.FC<Props> = (props) => {
</a> </a>
</li> </li>
{parts.map((e,i,arr)=>( {parts.map((e,i,arr)=>(
<li key={e} className="breadcrumb-item"> <>
<li className="inline mx-1">/</li>
<li key={e} className="inline mx-1">
<a onClick={()=>{ <a onClick={()=>{
if (i != arr.length - 1){ if (i != arr.length - 1){
props.onDirClick?.("/"+arr.slice(0,i-1).join("/")) props.onDirClick?.("/"+arr.slice(0,i-1).join("/"))
} }
}}>{e}</a> }}>{e}</a>
</li>))} </li></>))}
</ul> </ul>
) )
} }

View File

@ -1,7 +1,6 @@
import React from "react" import React from "react"
import { useState } from "react" import { useState } from "react"
import { useEffect } from "react" import { useEffect } from "react"
import style from "./../style/DragAndDrop.module.scss"
interface Props { interface Props {
onDrop?: ()=>void onDrop?: ()=>void
@ -52,7 +51,6 @@ const DragAndDrop: React.FC<Props> = (props) => {
useEffect(()=>{ useEffect(()=>{
if(dropRef.current){ if(dropRef.current){
console.debug("Add drag event listner")
dropRef.current.addEventListener("dragenter",handleDragEnter) dropRef.current.addEventListener("dragenter",handleDragEnter)
dropRef.current.addEventListener("dragleave",handleDragLeave) dropRef.current.addEventListener("dragleave",handleDragLeave)
dropRef.current.addEventListener("dragover",handleDragOver) dropRef.current.addEventListener("dragover",handleDragOver)
@ -60,7 +58,6 @@ const DragAndDrop: React.FC<Props> = (props) => {
return ()=>{ return ()=>{
if (dropRef.current){ if (dropRef.current){
console.debug("Remove drag event listner")
dropRef.current.removeEventListener("dragenter",handleDragEnter) dropRef.current.removeEventListener("dragenter",handleDragEnter)
dropRef.current.removeEventListener("dragleave",handleDragLeave) dropRef.current.removeEventListener("dragleave",handleDragLeave)
dropRef.current.removeEventListener("dragover",handleDragOver) dropRef.current.removeEventListener("dragover",handleDragOver)
@ -71,7 +68,10 @@ const DragAndDrop: React.FC<Props> = (props) => {
},[]) },[])
return ( return (
<div ref={dropRef} className={`${style.dragAndDrop} ${hover? style.active:""}`}> <div ref={dropRef}
className={`fixed top-0 left-0 w-full h-full z-10
${hover? "border-dashed border-gray-600 border-4":""}`}
>
{props.children} {props.children}
</div> </div>
) )

View File

@ -119,17 +119,17 @@ const FileBrowser: React.FC = () => {
}}/> }}/>
<div> <div>
{loading && {loading &&
<div className="loading loading-lg"></div> // TODO: center <div>Loading...</div> // TODO: center
} }
<table className="table table-striped table-hover"> <table className="w-full">
<thead> <thead className="border-b-2">
<tr> <tr>
<th>Name</th> <th className="text-left">Name</th>
<th>Last Modified</th> <th className="text-left">Last Modified</th>
<th>Size</th> <th className="text-left">Size</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody className="divide-y">
{ data?.directorys.map(v => (<FileBrowserElement { data?.directorys.map(v => (<FileBrowserElement
key={v?.id} key={v?.id}

View File

@ -14,6 +14,7 @@ interface Props {
const FileBrowserElement: React.FC<Props> = (props) => { const FileBrowserElement: React.FC<Props> = (props) => {
return ( return (
<tr <tr
className="hover:bg-gray-100 text-lg"
onClick={()=>{ onClick={()=>{
if(props.file){ if(props.file){
props.onClick?.(props.file) props.onClick?.(props.file)

View File

@ -14,7 +14,7 @@ const FileUploadButton: React.FC<Props> = (props) => {
<button onClick={()=>inputRef.current?.click()} > <button onClick={()=>inputRef.current?.click()} >
Upload files Upload files
</button> </button>
<input type="file" multiple style={{display:"none"}} ref={inputRef} onInput={()=>{ <input type="file" multiple className="hidden" ref={inputRef} onInput={()=>{
if (inputRef.current && inputRef.current.files){ if (inputRef.current && inputRef.current.files){
props.onUpload?.(inputRef.current.files) props.onUpload?.(inputRef.current.files)
} }

View File

@ -1,12 +1,11 @@
import React from "react" import React from "react"
import PropTypes from "prop-types" import PropTypes from "prop-types"
import genDownloadLink from "../functions/genDownloadLink" import genDownloadLink from "../functions/genDownloadLink"
import style from "./../App.module.scss"
import { FileOpenerProps } from "../types/FileOpenerProps" import { FileOpenerProps } from "../types/FileOpenerProps"
const ImageOpener: React.FC<FileOpenerProps> = (props) => { const ImageOpener: React.FC<FileOpenerProps> = (props) => {
return ( return (
<img className={`img-responsive img-fit-cover ${style.imageOpenerImage}`} src={genDownloadLink(props.file.id)}/> <img src={genDownloadLink(props.file.id)}/>
) )
} }

View File

@ -1,5 +1,4 @@
import React from "react" import React from "react"
import style from "./../style/Modal.module.scss"
interface Props { interface Props {
show: boolean show: boolean
@ -8,10 +7,14 @@ interface Props {
const Modal: React.FC<Props> = (props) => { const Modal: React.FC<Props> = (props) => {
return ( return (
<div className={`${style.overlay} ${!props.show && style.hidden}`} onClick={()=>{ <div
className={`${!props.show?"hidden":"" }
fixed z-10 left-0 top-0 w-full h-full
flex justify-center items-center bg-white bg-opacity-80`}
onClick={()=>{
props.onCloseClick?.() props.onCloseClick?.()
}}> }}>
<div className={style.body} onClick={(e)=>{ <div className="bg-white mx-auto p-5 border-2 w-10/12 overflow-hidden max-h-full" onClick={(e)=>{
e.stopPropagation() e.stopPropagation()
}}> }}>
{props.children} {props.children}

View File

@ -1,21 +0,0 @@
.active{
border: dashed grey 4px;
background-color: rgba(255,255,255,.8);
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 2;
}
.dragAndDrop{
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
position: absolute;
z-index: 2;
}

View File

@ -1,27 +0,0 @@
.overlay{
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.4);
display: flex;
justify-content: center;
align-items: center;
}
.body{
background-color: #fefefe;
margin-left: auto;
margin-right: auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-height: 99%;
overflow: hidden;
}
.hidden{
display: none;
}