mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 16:02:32 +00:00
46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
import { StyleSheet, Text, type TextStyle } from 'react-native'
|
|
import type { MobileSyntaxSegment, MobileSyntaxTokenKind } from '../session/mobile-file-syntax'
|
|
import { colors } from '../theme/mobile-theme'
|
|
|
|
export function MobileSyntaxSegments({ segments }: { segments: MobileSyntaxSegment[] }) {
|
|
return (
|
|
<>
|
|
{segments.map((segment, index) => (
|
|
<Text key={`${index}:${segment.kind}`} style={syntaxTokenStyles[segment.kind]}>
|
|
{segment.text}
|
|
</Text>
|
|
))}
|
|
</>
|
|
)
|
|
}
|
|
|
|
const syntaxTokenStyles: Record<MobileSyntaxTokenKind, TextStyle> = StyleSheet.create({
|
|
plain: {
|
|
color: colors.textPrimary
|
|
},
|
|
comment: {
|
|
color: colors.syntaxComment
|
|
},
|
|
keyword: {
|
|
color: colors.syntaxKeyword
|
|
},
|
|
string: {
|
|
color: colors.syntaxString
|
|
},
|
|
number: {
|
|
color: colors.syntaxNumber
|
|
},
|
|
type: {
|
|
color: colors.syntaxType
|
|
},
|
|
function: {
|
|
color: colors.syntaxFunction
|
|
},
|
|
variable: {
|
|
color: colors.syntaxVariable
|
|
},
|
|
meta: {
|
|
color: colors.syntaxMeta
|
|
}
|
|
})
|