Skip to content

Commit ff5b73f

Browse files
committed
#319 Add article view
1 parent 7b06835 commit ff5b73f

34 files changed

+579
-83
lines changed

data-browser/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"react-is": "^18",
2828
"react-markdown": "^8.0.3",
2929
"react-pdf": "^6.2.2",
30-
"react-router": "^6.0.0",
31-
"react-router-dom": "^6.0.0",
30+
"react-router": "^6.9.0",
31+
"react-router-dom": "^6.9.0",
3232
"remark-gfm": "^3.0.1",
3333
"styled-components": "^5.3.3",
3434
"yamde": "^1.7.1"

data-browser/src/components/Button.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,8 @@ export const ButtonBase = styled(ButtonClean)`
6868
background-color: ${props => props.theme.colors.main};
6969
color: ${props => props.theme.colors.bg};
7070
white-space: nowrap;
71-
transition: ${() =>
72-
transition('background-color', 'box-shadow', 'transform', 'color')};
7371
margin-bottom: ${p => (p.gutter ? `${p.theme.margin}rem` : '')};
72+
${transition('background-color', 'box-shadow', 'transform', 'color')};
7473
7574
// Prevent sticky hover buttons on touch devices
7675
@media (hover: hover) and (pointer: fine) {

data-browser/src/components/Card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const Card = styled.div<CardProps>`
1414
border: solid 1px ${props => props.theme.colors.bg2};
1515
box-shadow: ${props => props.theme.boxShadow};
1616
padding: ${props => props.theme.margin}rem;
17-
margin-bottom: ${props => props.theme.margin}rem;
17+
/* margin-bottom: ${props => props.theme.margin}rem; */
1818
padding-bottom: 0;
1919
border-radius: ${props => props.theme.radius};
2020
max-height: ${props => (props.small ? '10rem' : 'none')};

data-browser/src/components/CommitDetail.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function CommitDetail({ commitSubject }: Props): JSX.Element | null {
3030
return (
3131
<Detail>
3232
{signer && <ResourceInline subject={signer} />}
33-
{' - '}
33+
{'-'}
3434
<AtomicLink subject={commitSubject}>
3535
{previousCommit ? 'edited ' : ''}
3636
{createdAt && <DateTime date={createdAt} />}

data-browser/src/components/Containers.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const ContainerNarrow = styled.div`
1010
`;
1111

1212
export const ContainerWide = styled.div`
13-
max-width: ${props => props.theme.containerWidthWide};
13+
width: min(100%, ${props => props.theme.containerWidthWide});
1414
margin: auto;
1515
padding: ${props => props.theme.margin}rem;
1616
// Extra space for the navbar below

data-browser/src/components/Detail.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import styled from 'styled-components';
22

33
/** Small component showing some metadata. They appear next to each other. */
44
export const Detail = styled.div`
5-
display: inline-block;
5+
display: inline-flex;
6+
align-items: center;
7+
gap: 1ch;
68
margin-right: 2rem;
79
`;
810

data-browser/src/components/Dropdown/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,5 +369,5 @@ const Menu = styled.div<MenuProps>`
369369
box-shadow: ${p => p.theme.boxShadowSoft};
370370
opacity: ${p => (p.visible ? 1 : 0)};
371371
372-
transition: ${() => transition('opacity')};
372+
${transition('opacity')};
373373
`;

data-browser/src/components/ErrorLook.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { FaExclamationTriangle } from 'react-icons/fa';
66
export const ErrorLook = styled.span`
77
color: ${props => props.theme.colors.alert};
88
font-family: monospace;
9+
line-height: 1.2rem;
910
`;
1011

1112
export interface ErrorBlockProps {

data-browser/src/components/IconButton/IconButton.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export enum IconButtonVariant {
66
Simple,
77
Outline,
88
Fill,
9+
Colored,
910
}
1011

1112
type ColorProp = keyof DefaultTheme['colors'] | 'inherit';
@@ -75,7 +76,7 @@ const IconButtonBase = styled.button<BaseProps>`
7576
cursor: pointer;
7677
display: inline-grid;
7778
place-items: center;
78-
transition: ${() => transition('background-color', 'color', 'box-shadow')};
79+
${transition('background-color', 'color', 'box-shadow', 'filter')};
7980
color: ${p => p.theme.colors.text};
8081
font-size: ${p => p.size ?? '1em'};
8182
border: none;
@@ -143,8 +144,22 @@ const FillIconButton = styled(IconButtonBase)<ButtonStyleProps>`
143144
}
144145
`;
145146

147+
const ColoredIconButton = styled(IconButtonBase)<ButtonStyleProps>`
148+
color: white;
149+
background-color: ${p =>
150+
p.color === 'inherit' ? 'inherit' : p.theme.colors[p.color]};
151+
border-radius: 50%;
152+
&:hover,
153+
&:focus {
154+
color: white;
155+
filter: brightness(1.3);
156+
box-shadow: ${p => p.theme.boxShadowSoft};
157+
}
158+
`;
159+
146160
const ComponentMap = new Map([
147161
[IconButtonVariant.Simple, SimpleIconButton],
148162
[IconButtonVariant.Outline, OutlineIconButton],
149163
[IconButtonVariant.Fill, FillIconButton],
164+
[IconButtonVariant.Colored, ColoredIconButton],
150165
]);
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { FaPlus } from 'react-icons/fa';
2+
import styled from 'styled-components';
3+
import { GridCard } from '../views/FolderPage/GridItem/components';
4+
import React from 'react';
5+
6+
export interface NewCardProps {
7+
onClick: (e: React.MouseEvent) => void;
8+
}
9+
10+
export function NewCard({ onClick }: NewCardProps) {
11+
return (
12+
<Thing as='button' onClick={onClick}>
13+
<FaPlus />
14+
</Thing>
15+
);
16+
}
17+
18+
const Thing = styled(GridCard)`
19+
background-color: ${p => p.theme.colors.bg1};
20+
border: 1px solid ${p => p.theme.colors.bg2};
21+
cursor: pointer;
22+
display: grid;
23+
place-items: center;
24+
height: 100%;
25+
width: 100%;
26+
font-size: 3rem;
27+
color: ${p => p.theme.colors.textLight};
28+
transition: color 0.1s ease-in-out, font-size 0.1s ease-out,
29+
border-color 0.1s ease-in-out;
30+
&:hover,
31+
&:focus {
32+
color: ${p => p.theme.colors.main};
33+
font-size: 3.8rem;
34+
border-color: ${p => p.theme.colors.main};
35+
}
36+
37+
:active {
38+
font-size: 3rem;
39+
}
40+
`;

0 commit comments

Comments
 (0)