styling updates

This commit is contained in:
Travis Fischer
2021-01-25 16:30:49 -05:00
parent 1a4306cb88
commit f35d8eb0eb
5 changed files with 18 additions and 32 deletions

View File

@@ -1,21 +1,9 @@
import * as types from 'lib/types'
import { getTextContent } from 'notion-utils'
import * as types from './types'
import { getPageProperty } from 'notion-utils'
export function getPageDescription(
block: types.Block,
recordMap: types.RecordMap
recordMap: types.ExtendedRecordMap
): string | null {
const collection = recordMap.collection[block.parent_id]?.value
if (collection) {
const descriptionKey = Object.keys(collection.schema).find(
(key) => collection.schema[key].name === 'Description'
)
if (descriptionKey) {
return getTextContent(block.properties[descriptionKey])
}
}
return null
return getPageProperty('Description', block, recordMap)
}