improvement(a11y): use more semantic html tags in collections view (#1585)
This commit is contained in:
parent
95c8de0029
commit
4782c472bf
@ -160,7 +160,7 @@ describe('Editorial Workflow', () => {
|
|||||||
|
|
||||||
function assertOnCollectionsPage() {
|
function assertOnCollectionsPage() {
|
||||||
cy.url().should('contain', '/#/collections/posts')
|
cy.url().should('contain', '/#/collections/posts')
|
||||||
cy.contains('h1', 'Collections')
|
cy.contains('h2', 'Collections')
|
||||||
}
|
}
|
||||||
|
|
||||||
it('successfully loads', () => {
|
it('successfully loads', () => {
|
||||||
|
@ -21,7 +21,7 @@ const styles = {
|
|||||||
`,
|
`,
|
||||||
};
|
};
|
||||||
|
|
||||||
const AppHeaderContainer = styled.div`
|
const AppHeaderContainer = styled.header`
|
||||||
z-index: 300;
|
z-index: 300;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ const CollectionContainer = styled.div`
|
|||||||
margin: ${lengths.pageMargin};
|
margin: ${lengths.pageMargin};
|
||||||
`
|
`
|
||||||
|
|
||||||
const CollectionMain = styled.div`
|
const CollectionMain = styled.main`
|
||||||
padding-left: 280px;
|
padding-left: 280px;
|
||||||
`
|
`
|
||||||
|
|
||||||
|
@ -5,27 +5,33 @@ import { resolvePath } from 'netlify-cms-lib-util';
|
|||||||
import { colors, colorsRaw, components, lengths } from 'netlify-cms-ui-default';
|
import { colors, colorsRaw, components, lengths } from 'netlify-cms-ui-default';
|
||||||
import { VIEW_STYLE_LIST, VIEW_STYLE_GRID } from 'Constants/collectionViews';
|
import { VIEW_STYLE_LIST, VIEW_STYLE_GRID } from 'Constants/collectionViews';
|
||||||
|
|
||||||
const ListCardLink = styled(Link)`
|
const ListCard = styled.li`
|
||||||
${components.card};
|
${components.card};
|
||||||
width: ${lengths.topCardWidth};
|
width: ${lengths.topCardWidth};
|
||||||
max-width: 100%;
|
|
||||||
padding: 16px 22px;
|
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
|
`
|
||||||
|
|
||||||
|
const ListCardLink = styled(Link)`
|
||||||
|
display: block;
|
||||||
|
max-width: 100%;
|
||||||
|
padding: 16px 22px;
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: ${colors.foreground};
|
background-color: ${colors.foreground};
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const GridCardLink = styled(Link)`
|
const GridCard = styled.li`
|
||||||
${components.card};
|
${components.card};
|
||||||
flex: 0 0 335px;
|
flex: 0 0 335px;
|
||||||
height: 240px;
|
height: 240px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
|
`
|
||||||
|
|
||||||
|
const GridCardLink = styled(Link)`
|
||||||
|
display: block;
|
||||||
&, &:hover {
|
&, &:hover {
|
||||||
background-color: ${colors.foreground};
|
background-color: ${colors.foreground};
|
||||||
color: ${colors.text};
|
color: ${colors.text};
|
||||||
@ -92,15 +98,18 @@ const EntryCard = ({
|
|||||||
|
|
||||||
if (viewStyle === VIEW_STYLE_LIST) {
|
if (viewStyle === VIEW_STYLE_LIST) {
|
||||||
return (
|
return (
|
||||||
|
<ListCard>
|
||||||
<ListCardLink to={path}>
|
<ListCardLink to={path}>
|
||||||
{ collectionLabel ? <CollectionLabel>{collectionLabel}</CollectionLabel> : null }
|
{ collectionLabel ? <CollectionLabel>{collectionLabel}</CollectionLabel> : null }
|
||||||
<ListCardTitle>{ title }</ListCardTitle>
|
<ListCardTitle>{ title }</ListCardTitle>
|
||||||
</ListCardLink>
|
</ListCardLink>
|
||||||
|
</ListCard>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewStyle === VIEW_STYLE_GRID) {
|
if (viewStyle === VIEW_STYLE_GRID) {
|
||||||
return (
|
return (
|
||||||
|
<GridCard>
|
||||||
<GridCardLink to={path}>
|
<GridCardLink to={path}>
|
||||||
<CardBody hasImage={image}>
|
<CardBody hasImage={image}>
|
||||||
{ collectionLabel ? <CollectionLabel>{collectionLabel}</CollectionLabel> : null }
|
{ collectionLabel ? <CollectionLabel>{collectionLabel}</CollectionLabel> : null }
|
||||||
@ -108,6 +117,7 @@ const EntryCard = ({
|
|||||||
</CardBody>
|
</CardBody>
|
||||||
{ image ? <CardImage url={image}/> : null }
|
{ image ? <CardImage url={image}/> : null }
|
||||||
</GridCardLink>
|
</GridCardLink>
|
||||||
|
</GridCard>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,10 @@ import { Cursor } from 'netlify-cms-lib-util';
|
|||||||
import { selectFields, selectInferedField } from 'Reducers/collections';
|
import { selectFields, selectInferedField } from 'Reducers/collections';
|
||||||
import EntryCard from './EntryCard';
|
import EntryCard from './EntryCard';
|
||||||
|
|
||||||
const CardsGrid = styled.div`
|
const CardsGrid = styled.ul`
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: row wrap;
|
flex-flow: row wrap;
|
||||||
|
list-style-type: none;
|
||||||
margin-left: -12px;
|
margin-left: -12px;
|
||||||
`
|
`
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ const styles = {
|
|||||||
`,
|
`,
|
||||||
};
|
};
|
||||||
|
|
||||||
const SidebarContainer = styled.div`
|
const SidebarContainer = styled.aside`
|
||||||
${components.card};
|
${components.card};
|
||||||
width: 250px;
|
width: 250px;
|
||||||
padding: 8px 0 12px;
|
padding: 8px 0 12px;
|
||||||
@ -22,7 +22,7 @@ const SidebarContainer = styled.div`
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
`
|
`
|
||||||
|
|
||||||
const SidebarHeading = styled.h1`
|
const SidebarHeading = styled.h2`
|
||||||
font-size: 23px;
|
font-size: 23px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user