Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make sheetCell always return a Span #907

Merged
merged 2 commits into from
Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/hackathon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ application: hackathon {
"https://*.slack.com/*",
"https://*.git.luolix.top/*",
"https://*.youtube.com/*",
"https://*.youtu.be/*",
"https://*.vimeo.com/*"
]
use_form_submit: yes
Expand Down
12 changes: 6 additions & 6 deletions packages/hackathon/src/models/sheetUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
import type { SheetValues } from '@looker/wholly-sheet'
import type { DataTableColumn, DataTableColumns } from '@looker/components'
import { Icon } from '@looker/components'
import { Span, Icon } from '@looker/components'
import { Done } from '@styled-icons/material/Done'
import React from 'react'

Expand Down Expand Up @@ -86,10 +86,10 @@ export const sheetHeader = (header: string[], row: any) => {
* @param value to convert to displayable actionitem
*/
export const sheetCell = (value: any) => {
if (typeof value === 'undefined') return ''
if (typeof value === 'undefined') return <Span></Span>

if (typeof value === 'boolean') {
return value ? <Icon size="small" icon={<Done />} /> : ''
return value ? <Icon size="small" icon={<Done />} /> : <Span></Span>
}

if (value instanceof Set) {
Expand All @@ -98,10 +98,10 @@ export const sheetCell = (value: any) => {
for (const v of value.values()) {
values.push(v.toString())
}
return values.join(', ')
return <Span>{values.join(', ')}</Span>
}
if (value instanceof Date) {
return value.toDateString()
return <Span>{value.toDateString()}</Span>
}
return value.toString()
return <Span>{value.toString()}</Span>
}