content.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { MultipleCodeBlock } from 'ui-patterns/MultipleCodeBlock'
  2. import type { StepContentProps } from '@/components/interfaces/ConnectSheet/Connect.types'
  3. const ContentFile = ({ projectKeys }: StepContentProps) => {
  4. const files = [
  5. {
  6. name: '.env.local',
  7. language: 'bash',
  8. code: `
  9. BRIVEN_URL=${projectKeys.apiUrl ?? 'your-project-url'}
  10. BRIVEN_KEY=${projectKeys.publishableKey ?? projectKeys.anonKey ?? 'your-anon-key'}
  11. `,
  12. },
  13. {
  14. name: 'src/db/briven.js',
  15. language: 'js',
  16. code: `
  17. import { createClient } from "@supabase/supabase-js";
  18. const brivenUrl = import.meta.env.BRIVEN_URL;
  19. const brivenKey = import.meta.env.BRIVEN_KEY;
  20. export const briven = createClient(brivenUrl, brivenKey);
  21. `,
  22. },
  23. {
  24. name: 'src/pages/index.astro',
  25. language: 'html',
  26. code: `
  27. ---
  28. import { briven } from '../db/briven';
  29. const { data, error } = await briven.from("todos").select('*');
  30. ---
  31. {
  32. (
  33. <ul>
  34. {data.map((entry) => (
  35. <li>{entry.name}</li>
  36. ))}
  37. </ul>
  38. )
  39. }
  40. `,
  41. },
  42. ]
  43. return <MultipleCodeBlock files={files} />
  44. }
  45. export default ContentFile