mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-25 01:16:18 -05:00
Replacing drop shadow of Cards to emphasize color.
This commit is contained in:
parent
9f52f41d56
commit
595e82b354
5 changed files with 79 additions and 34 deletions
|
|
@ -1,6 +1,9 @@
|
|||
import React, {useContext, useState} from "react";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardMeta,
|
||||
Confirm,
|
||||
Container,
|
||||
Image,
|
||||
|
|
@ -38,7 +41,7 @@ import Grid from "semantic-ui-react/dist/commonjs/collections/Grid";
|
|||
import Dropdown from "semantic-ui-react/dist/commonjs/modules/Dropdown";
|
||||
import _ from "lodash";
|
||||
import {ThemeContext} from "../contexts/contexts";
|
||||
import {Button, CardIcon, Header, Loader, Placeholder, Segment, Table} from "./Theme";
|
||||
import {Button, Card, CardIcon, Header, Loader, Placeholder, Segment, Table} from "./Theme";
|
||||
|
||||
function ArchivePage() {
|
||||
const [deleteOpen, setDeleteOpen] = useState(false);
|
||||
|
|
@ -185,37 +188,37 @@ export function ArchiveCard({file}) {
|
|||
const domainUrl = `/archive?domain=${domain}`;
|
||||
|
||||
return (
|
||||
<Card color={mimetypeColor(file.mimetype)} {...s}>
|
||||
<Card color={mimetypeColor(file.mimetype)}>
|
||||
<div>
|
||||
<ExternalCardLink to={singlefileUrl}>
|
||||
{screenshot}
|
||||
</ExternalCardLink>
|
||||
</div>
|
||||
<Card.Content>
|
||||
<Card.Header>
|
||||
<CardContent {...s}>
|
||||
<CardHeader>
|
||||
<Container textAlign='left'>
|
||||
<ExternalCardLink to={singlefileUrl}>
|
||||
{textEllipsis(archive.title || archive.url, 100)}
|
||||
</ExternalCardLink>
|
||||
</Container>
|
||||
</Card.Header>
|
||||
</CardHeader>
|
||||
{domain &&
|
||||
<CardLink to={domainUrl}>
|
||||
<p {...s}>{domain}</p>
|
||||
</CardLink>}
|
||||
<Card.Meta {...s}>
|
||||
<CardMeta {...s}>
|
||||
<p>
|
||||
{uploadDate(archive.archive_datetime)}
|
||||
</p>
|
||||
</Card.Meta>
|
||||
<Card.Description>
|
||||
</CardMeta>
|
||||
<CardDescription>
|
||||
<Link to={`/archive/${archive.id}`}>
|
||||
<Button icon='file alternate' content='Details'
|
||||
labelPosition='left'/>
|
||||
</Link>
|
||||
<Button icon='external' href={archive.url} target='_blank' rel='noopener noreferrer'/>
|
||||
</Card.Description>
|
||||
</Card.Content>
|
||||
</CardDescription>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -345,12 +345,12 @@ export function SearchInput({
|
|||
|
||||
return <Form onSubmit={localOnSubmit} {...props}>
|
||||
<Input fluid
|
||||
placeholder={placeholder}
|
||||
type='text'
|
||||
onChange={(e) => setValue(e.target.value)}
|
||||
value={value}
|
||||
size={size}
|
||||
action={action}
|
||||
placeholder={placeholder}
|
||||
type='text'
|
||||
onChange={(e) => setValue(e.target.value)}
|
||||
value={value}
|
||||
size={size}
|
||||
action={action}
|
||||
/>
|
||||
</Form>
|
||||
}
|
||||
|
|
@ -745,3 +745,21 @@ export const BackButton = () => {
|
|||
const navigate = useNavigate();
|
||||
return <Button icon='arrow left' content='Back' onClick={() => navigate(-1)}/>;
|
||||
}
|
||||
|
||||
export const ColorToSemanticHexColor = (color) => {
|
||||
const colorMap = {
|
||||
red: '#db2828',
|
||||
orange: '#f2711c',
|
||||
yellow: '#fbbd08',
|
||||
olive: '#b5cc18',
|
||||
green: '#21ba45',
|
||||
teal: '#00b5ad',
|
||||
blue: '#2185d0',
|
||||
violet: '#6435c9',
|
||||
purple: '#a333c8',
|
||||
pink: '#e03997',
|
||||
brown: '#a5673f',
|
||||
grey: '#767676',
|
||||
}
|
||||
return colorMap[color] || null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,16 @@
|
|||
import React, {useContext} from "react";
|
||||
import FileBrowser from 'react-keyed-file-browser';
|
||||
import {Card, Confirm, Divider, Dropdown, Image, PlaceholderLine, TableCell, TableHeaderCell,} from "semantic-ui-react";
|
||||
import {
|
||||
CardContent,
|
||||
CardHeader,
|
||||
Confirm,
|
||||
Divider,
|
||||
Dropdown,
|
||||
Image,
|
||||
PlaceholderLine,
|
||||
TableCell,
|
||||
TableHeaderCell,
|
||||
} from "semantic-ui-react";
|
||||
import 'react-keyed-file-browser/dist/react-keyed-file-browser.css';
|
||||
import {deleteFile, refreshDirectoryFiles, refreshFiles} from "../api";
|
||||
import {
|
||||
|
|
@ -22,7 +32,7 @@ import {CardPlacholder} from "./Placeholder";
|
|||
import {ArchiveCard, ArchiveRowCells} from "./Archive";
|
||||
import Grid from "semantic-ui-react/dist/commonjs/collections/Grid";
|
||||
import {ThemeContext} from "../contexts/contexts";
|
||||
import {Button, CardIcon, Header, Icon, Placeholder, Segment} from "./Theme";
|
||||
import {Button, Card, CardIcon, Header, Icon, Placeholder, Segment} from "./Theme";
|
||||
import {SelectableTable} from "./Tables";
|
||||
import {VideoCard, VideoRowCells} from "./Videos";
|
||||
|
||||
|
|
@ -185,15 +195,15 @@ function FileCard({file}) {
|
|||
<FileIcon file={file}/>
|
||||
</CardIcon>
|
||||
</ExternalCardLink>
|
||||
<Card.Content {...s}>
|
||||
<Card.Header>
|
||||
<CardContent {...s}>
|
||||
<CardHeader>
|
||||
<ExternalCardLink to={url}>
|
||||
{textEllipsis(file.title || file.stem || file.path)}
|
||||
</ExternalCardLink>
|
||||
</Card.Header>
|
||||
</CardHeader>
|
||||
<p>{uploadDate(file.modified / 1000)}</p>
|
||||
<p>{size}</p>
|
||||
</Card.Content>
|
||||
</CardContent>
|
||||
</Card>
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import {ThemeContext} from "../contexts/contexts";
|
|||
import {
|
||||
Accordion as ACCORDION,
|
||||
Button as BUTTON,
|
||||
Card as CARD,
|
||||
Form as FORM,
|
||||
FormField as FORM_FIELD,
|
||||
FormGroup as FORM_GROUP,
|
||||
|
|
@ -22,7 +23,7 @@ import {
|
|||
TabPane as TAB_PANE,
|
||||
TextArea as TEXTAREA
|
||||
} from "semantic-ui-react";
|
||||
import {isEmpty} from "./Common";
|
||||
import {isEmpty, ColorToSemanticHexColor} from "./Common";
|
||||
|
||||
export const darkTheme = 'dark';
|
||||
export const lightTheme = 'light';
|
||||
|
|
@ -290,3 +291,13 @@ export function CardIcon(props) {
|
|||
const {inverted} = useContext(ThemeContext);
|
||||
return <center className={`card-icon ${inverted}`} {...props}/>
|
||||
}
|
||||
|
||||
export function Card({color, ...props}) {
|
||||
props['style'] = props['style'] || {};
|
||||
let hexColor = ColorToSemanticHexColor(color);
|
||||
if (hexColor) {
|
||||
// Increase drop shadow to emphasize color.
|
||||
props['style']['boxShadow'] = `0 0 0 2px #d4d4d5, 0 5px 0 0 ${hexColor}, 0 0px 3px 0 #d4d4d5`;
|
||||
}
|
||||
return <CARD {...props}/>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,9 @@ import {
|
|||
} from "./Common"
|
||||
import VideoPage from "./VideoPlayer";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
Confirm,
|
||||
Container,
|
||||
Dropdown,
|
||||
|
|
@ -35,7 +37,7 @@ import {useChannel, useQuery, useSearchVideos, useVideo, useVideoStatistics} fro
|
|||
import {FilesView} from "./Files";
|
||||
import Grid from "semantic-ui-react/dist/commonjs/collections/Grid";
|
||||
import Icon from "semantic-ui-react/dist/commonjs/elements/Icon";
|
||||
import {Button, CardIcon, Header, Loader, Placeholder, Segment, Statistic, StatisticGroup} from "./Theme";
|
||||
import {Button, Card, CardIcon, Header, Loader, Placeholder, Segment, Statistic, StatisticGroup} from "./Theme";
|
||||
import {deleteVideos} from "../api";
|
||||
import {ThemeContext} from "../contexts/contexts";
|
||||
|
||||
|
|
@ -323,27 +325,28 @@ export function VideoCard({file}) {
|
|||
poster = <CardPosterLink to={video_url} poster_url={poster_url} imageLabel={imageLabel}/>;
|
||||
}
|
||||
|
||||
return (<Card color={mimetypeColor(file.mimetype)}>
|
||||
const color = mimetypeColor(file.mimetype);
|
||||
return <Card color={color}>
|
||||
{poster}
|
||||
<Duration video={video}/>
|
||||
<Card.Content {...s}>
|
||||
<Card.Header>
|
||||
<CardContent {...s}>
|
||||
<CardHeader>
|
||||
<Container textAlign='left'>
|
||||
<Link to={video_url} className="no-link-underscore card-link">
|
||||
<p {...s}>{textEllipsis(video.title || video.stem || video.video_path, 100)}</p>
|
||||
</Link>
|
||||
</Container>
|
||||
</Card.Header>
|
||||
<Card.Description>
|
||||
</CardHeader>
|
||||
<CardDescription>
|
||||
<Container textAlign='left'>
|
||||
{channel && <Link to={channel_url} className="no-link-underscore card-link">
|
||||
<b {...s}>{channel.name}</b>
|
||||
</Link>}
|
||||
<p {...s}>{upload_date}</p>
|
||||
</Container>
|
||||
</Card.Description>
|
||||
</Card.Content>
|
||||
</Card>)
|
||||
</CardDescription>
|
||||
</CardContent>
|
||||
</Card>
|
||||
}
|
||||
|
||||
export function VideoRowCells({file}) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue