Skip to content

Commit

Permalink
BASIRA #270 - Refactoring artwork, physical component, visual context…
Browse files Browse the repository at this point in the history
…, and document detail page layouts
  • Loading branch information
dleadbetter committed Dec 9, 2024
1 parent c88ac5c commit cafc33d
Show file tree
Hide file tree
Showing 17 changed files with 639 additions and 561 deletions.
3 changes: 3 additions & 0 deletions client/src/components/ArtworkCreators.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.artwork-creators.ui.items > .item > .content > .header > .ui.header.tiny {
font-size: 1rem;
}
16 changes: 11 additions & 5 deletions client/src/components/ArtworkCreators.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// @flow

import React from 'react';
import { Item } from 'semantic-ui-react';
import { Header, Item } from 'semantic-ui-react';
import _ from 'underscore';
import type { Participation } from '../types/Participation';
import Qualifiables from '../utils/Qualifiables';
import CertaintyLabel from './CertaintyLabel';
import RolesView from './RolesView';
import SimpleLink from './SimpleLink';
import './ArtworkCreators.css';

type Props = {
items: Array<Participation>
Expand All @@ -20,18 +21,23 @@ const ArtworkCreators = (props: Props) => {

return (
<Item.Group
className='artwork-creators'
divided
relaxed='very'
>
{ _.map(props.items, (item) => (
<Item>
<Item.Content>
<Item.Header>
<SimpleLink
url={`/people/${item.person.id}`}
<Header
className='tiny'
>
{ item.person.display_name }
</SimpleLink>
<SimpleLink
url={`/people/${item.person.id}`}
>
{ item.person.display_name }
</SimpleLink>
</Header>
</Item.Header>
<Item.Meta>
{ Qualifiables.getValueListValue(item.person, 'Person', 'Nationality') }
Expand Down
4 changes: 4 additions & 0 deletions client/src/components/ArtworkTitles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.artwork-titles .icon.white {
color: #FFFFFF;
}

.artwork-titles.list > .item > .content > .description {
margin-top: 0.5rem;
}
1 change: 0 additions & 1 deletion client/src/components/ArtworkTitles.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const ArtworkTitles = (props: Props) => {
<List.Icon
color={item.primary ? 'green' : 'white'}
name='check circle'
verticalAlign='middle'
/>
<List.Content>
<List.Header
Expand Down
28 changes: 28 additions & 0 deletions client/src/components/AttributesGrid.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.attributes-grid.ui.segment {
font-size: 13px;
}

.attributes-grid.ui.segment .ui[class*="vertically divided"].grid > .row {
padding: 0px;
}

.attributes-grid.ui.segment .ui[class*="vertically divided"].grid > .row:before {
width: 100%;
margin: 0px;
}

.attributes-grid.ui.segment .ui[class*="vertically divided"].grid > .row:first-child > .column {
margin-top: 1rem;
}

.attributes-grid.ui.segment .ui[class*="vertically divided"].grid > .row > .column {
margin: 0.5rem 0px;
}

.attributes-grid.ui.segment .ui[class*="vertically divided"].grid > .row > .column.label {
color: #6c757d;
}

.attributes-grid.ui.segment .ui[class*="vertically divided"].grid > .row > .column.value {
font-weight: 400;
}
25 changes: 19 additions & 6 deletions client/src/components/AttributesGrid.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// @flow

import React, { useCallback, type Element } from 'react';
import { Grid, Segment } from 'semantic-ui-react';
import { Grid, Header, Segment } from 'semantic-ui-react';
import _ from 'underscore';
import './AttributesGrid.css';

type Attribute = {
name: string,
Expand Down Expand Up @@ -91,13 +92,12 @@ const AttributesGrid = (props: Props) => {
>
<Grid.Column
className='label'
floated='right'
textAlign='right'
width={8}
>
{ attribute.label }
</Grid.Column>
<Grid.Column
className='value'
width={8}
floated='left'
textAlign='left'
Expand All @@ -109,11 +109,24 @@ const AttributesGrid = (props: Props) => {
}, [renderAttributeValue]);

return (
<Segment>
<Segment
className='attributes-grid'
>
<Grid
className='attributes-grid'
divided
divided='vertically'
>
{ props.title && (
<Grid.Row
className='title'
>
<Grid.Column>
<Header
content={props.title}
size='tiny'
/>
</Grid.Column>
</Grid.Row>
)}
{ _.map(props.attributes, renderRow.bind(this)) }
</Grid>
</Segment>
Expand Down
3 changes: 3 additions & 0 deletions client/src/components/DocumentActions.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.document-actions.ui.cards > .card > .content > .header > .ui.header.tiny {
font-size: 1rem;
}
47 changes: 28 additions & 19 deletions client/src/components/DocumentActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { Item, Label } from 'semantic-ui-react';
import { Card, Header, Label } from 'semantic-ui-react';
import _ from 'underscore';
import type { Action } from '../types/Action';
import './DocumentActions.css';

type Props = {
// $FlowIgnore - Not sure why this is throwing a Flow error
items: Array<Action>
};

Expand Down Expand Up @@ -50,28 +50,37 @@ const DocumentActions = (props: Props) => {
}

return (
<Item.Group
divided
<Card.Group
className='document-actions'
itemsPerRow={4}
>
{ _.map(props.items, (item, index) => (
<Item
<Card
key={index}
>
<Item.Content>
<Item.Header>
{ renderActionText(item) }
</Item.Header>
<Item.Description>
{ item.notes }
</Item.Description>
<Item.Extra>
{ renderDescriptors(item, 'Characteristic', 'blue') }
{ renderDescriptors(item, 'Body', 'green') }
</Item.Extra>
</Item.Content>
</Item>
<Card.Content>
<Card.Header
>
<Header
content={renderActionText(item)}
size='tiny'
/>
</Card.Header>
{ item.notes && (
<Card.Description
content={item.notes}
/>
)}
</Card.Content>
<Card.Content
extra
>
{ renderDescriptors(item, 'Characteristic', 'blue') }
{ renderDescriptors(item, 'Body', 'green') }
</Card.Content>
</Card>
))}
</Item.Group>
</Card.Group>
);
};

Expand Down
3 changes: 3 additions & 0 deletions client/src/components/Locations.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.locations.ui.items > .item > .content > .header > .ui.header.tiny {
font-size: 1rem;
}
16 changes: 11 additions & 5 deletions client/src/components/Locations.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

import React from 'react';
import { useTranslation } from 'react-i18next';
import { Item } from 'semantic-ui-react';
import { Header, Item } from 'semantic-ui-react';
import _ from 'underscore';
import CertaintyLabel from './CertaintyLabel';
import type { Location } from '../types/Location';
import RolesView from './RolesView';
import Qualifiables from '../utils/Qualifiables';
import SimpleLink from './SimpleLink';
import './Locations.css';

type Props = {
items: Array<Location>
Expand All @@ -23,18 +24,23 @@ const Locations = (props: Props) => {

return (
<Item.Group
className='locations'
divided
relaxed='very'
>
{ _.map(props.items, (item) => (
<Item>
<Item.Content>
<Item.Header>
<SimpleLink
url={`/places/${item.place_id}`}
<Header
size='tiny'
>
{ item.place?.name }
</SimpleLink>
<SimpleLink
url={`/places/${item.place_id}`}
>
{ item.place?.name }
</SimpleLink>
</Header>
</Item.Header>
<Item.Meta
content={item.place?.country}
Expand Down
28 changes: 6 additions & 22 deletions client/src/components/RecordPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,13 @@
margin-bottom: 2em;
}

.record-page .attributes-grid > .row:nth-child(odd) {
background-color: #f1f1f1;
}

.record-page .attributes-grid > .row > .column.label {
display: flex;
flex-direction: column;
justify-content: center;
font-weight: bold;
}

.record-page .record-page-image {
display: flex;
flex-direction: column;
align-items: center;
}

.record-page .lazy-image {
width: fit-content;
width: 250px;
height: 250px;
}

.record-page .lazy-image img {
max-height: 500px;
.record-page .lazy-image .ui.medium.image {
width: 100%;
height: 100%;
object-fit: cover;
}

}
36 changes: 32 additions & 4 deletions client/src/components/RecordPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import React, {
import { Link } from 'react-router-dom';
import {
Button,
Container,
Header,
Container, Grid,
Header as SemanticHeader,
Loader,
Menu,
Ref,
Expand Down Expand Up @@ -142,10 +142,10 @@ const Section = (props: SectionProps) => (
className={`section ${props.className ? props.className : ''}`}
>
{ props.title && (
<Header
<SemanticHeader
content={props.title}
dividing
size='large'
size='small'
/>
)}
{ props.children }
Expand Down Expand Up @@ -178,4 +178,32 @@ const Image = (props: ImageProps) => (

RecordPage.Image = Image;

type HeaderProps = {
children: Node,
image: Attachment
};

const Header = (props: HeaderProps) => (
<Grid
columns={2}
>
{ props.image && (
<Grid.Column
width={4}
>
<RecordPage.Image
item={props.image}
/>
</Grid.Column>
)}
<Grid.Column
width={12}
>
{ props.children }
</Grid.Column>
</Grid>
);

RecordPage.Header = Header;

export default RecordPage;
1 change: 1 addition & 0 deletions client/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
},
"labels": {
"artwork": "Artwork",
"details": "Details",
"document": "Document",
"id": "ID",
"physicalComponent": "Physical Component",
Expand Down
Loading

0 comments on commit cafc33d

Please sign in to comment.