import * as React from 'react' import { GoogleDriveBlock } from 'notion-types' import { useNotionContext } from '../context' import { cs } from '../utils' import { GracefulImage } from './graceful-image' export const GoogleDrive: React.FC<{ block: GoogleDriveBlock blockId: string className?: string }> = ({ block, blockId, className }) => { const { components, mapImageUrl } = useNotionContext() const properties = block.format?.drive_properties if (!properties) return null let domain try { const url = new URL(properties.url) domain = url.hostname } catch (err) { // ignore invalid urls for robustness } return (
{properties.title && (
{properties.title}
)} {/* TODO: re-add last modified time with alternative to timeago.js */} {/* {properties.modified_time && (
Last modified{' '} {properties.user_name ? `by ${properties.user_name} ` : ''} {timeago(properties.modified_time)}
)} */} {properties.icon && domain && (
{properties.icon && (
)} {domain && (
{domain}
)}
)}
) }