content.tsx70 lines · main
1import { MultipleCodeBlock } from 'ui-patterns/MultipleCodeBlock'
2
3import type { StepContentProps } from '@/components/interfaces/ConnectSheet/Connect.types'
4
5const ContentFile = ({ projectKeys }: StepContentProps) => {
6 const files = [
7 {
8 name: 'Briven.swift',
9 language: 'swift',
10 code: `
11import Foundation
12import Briven
13
14let briven = BrivenClient(
15 brivenURL: URL(string: "${projectKeys.apiUrl ?? 'your-project-url'}")!,
16 brivenKey: "${projectKeys.publishableKey ?? '<prefer publishable key for native apps instead of anon key>'}"
17)
18 `,
19 },
20 {
21 name: 'Todo.swift',
22 language: 'swift',
23 code: `
24import Foundation
25
26struct Todo: Identifiable, Decodable {
27 var id: Int
28 var name: String
29}
30`,
31 },
32 {
33 name: 'ContentView.swift',
34 language: 'swift',
35 code: `
36import Briven
37import SwiftUI
38
39struct ContentView: View {
40 @State var todos: [Todo] = []
41
42 var body: some View {
43 NavigationStack {
44 List(todos) { todo in
45 Text(todo.name)
46 }
47 .navigationTitle("Todos")
48 .task {
49 do {
50 todos = try await briven.from("todos").select().execute().value
51 } catch {
52 debugPrint(error)
53 }
54 }
55 }
56 }
57}
58
59#Preview {
60 ContentView()
61}
62
63`,
64 },
65 ]
66
67 return <MultipleCodeBlock files={files} />
68}
69
70export default ContentFile