-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[desk-tool] Fix styling of referring documents list (#266)
- Loading branch information
Showing
6 changed files
with
52 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
packages/@sanity/desk-tool/src/components/ReferringDocumentLink.js
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
packages/@sanity/desk-tool/src/components/ReferringDocumentsList.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import {List as DefaultList, Item as DefaultItem} from 'part:@sanity/components/lists/default' | ||
import styles from './styles/ReferringDocumentsList.css' | ||
import Preview from 'part:@sanity/base/preview' | ||
import {IntentLink} from 'part:@sanity/base/router' | ||
import schema from 'part:@sanity/base/schema' | ||
|
||
export default function ReferringDocumentsList(props) { | ||
const {documents} = props | ||
return ( | ||
<DefaultList className={styles.root}> | ||
{documents.map(document => { | ||
const schemaType = schema.get(document._type) | ||
return ( | ||
<DefaultItem className={styles.item} key={document._id}> | ||
{schemaType | ||
? ( | ||
<IntentLink className={styles.link} intent="edit" params={{id: document._id, type: document._type}}> | ||
<Preview value={document} type={schemaType} /> | ||
</IntentLink> | ||
) | ||
: <div>A document of the unknown type <em>{document._type}</em></div> | ||
} | ||
</DefaultItem> | ||
) | ||
})} | ||
</DefaultList> | ||
) | ||
} | ||
|
||
ReferringDocumentsList.propTypes = { | ||
documents: PropTypes.arrayOf(PropTypes.shape({ | ||
_id: PropTypes.string, | ||
_type: PropTypes.string | ||
})) | ||
} |
3 changes: 0 additions & 3 deletions
3
packages/@sanity/desk-tool/src/components/styles/ReferringDocumentLink.css
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
packages/@sanity/desk-tool/src/components/styles/ReferringDocumentsList.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
.root { | ||
composes: root from 'part:@sanity/components/lists/default-style'; | ||
} | ||
.item { | ||
composes: lineBetween from 'part:@sanity/components/lists/default-item-style'; | ||
padding: 1px 0; | ||
} | ||
.link { | ||
color: inherit; | ||
} |