mirror of
https://github.com/supabase/supabase.git
synced 2026-10-17 07:09:07 +03:00
* add new page * moar * moar * added icons * improve icons * moved connect dialog to main header * update text * smaller screen support * moar * add python and sqlalchemyString * moar * add IPv4 warning * moar * Delete pooler-icons-v2.tsx * tidy * Delete DatabaseSettings.tsx * tidy * tidy * moar. Session pooler is de-prioritized * Update DatabaseConnectionString.tsx * type issue * moar * Update DatabaseConnectionString.tsx * Spelling * Clean up LayoutHeader * Clean up ConnectionPanel * Clean up ConnectionParameters * Last batch of clean up * Fix loading state padding * Shift old Connect files to new Connect folder outside of Home * Final clean up * Smol fix * FIX * Fix button link * Fixes * Lint --------- Co-authored-by: Terry Sutton <saltcod@gmail.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
72 lines
1.9 KiB
TypeScript
72 lines
1.9 KiB
TypeScript
import type { ContentFileProps } from 'components/interfaces/Connect/Connect.types'
|
|
|
|
import {
|
|
ConnectTabs,
|
|
ConnectTabTrigger,
|
|
ConnectTabTriggers,
|
|
ConnectTabContent,
|
|
} from 'components/interfaces/Connect/ConnectTabs'
|
|
import { SimpleCodeBlock } from '@ui/components/SimpleCodeBlock'
|
|
|
|
const ContentFile = ({ projectKeys }: ContentFileProps) => {
|
|
return (
|
|
<ConnectTabs>
|
|
<ConnectTabTriggers>
|
|
<ConnectTabTrigger value=".env.local" />
|
|
<ConnectTabTrigger value="utils/supabase.ts" />
|
|
<ConnectTabTrigger value="src/App.jsx" />
|
|
</ConnectTabTriggers>
|
|
|
|
<ConnectTabContent value=".env.local">
|
|
<SimpleCodeBlock className="bash" parentClassName="min-h-72">
|
|
{`
|
|
SUPABASE_URL=${projectKeys.apiUrl ?? 'your-project-url'}
|
|
SUPABASE_ANON_KEY=${projectKeys.anonKey ?? 'your-anon-key'}
|
|
`}
|
|
</SimpleCodeBlock>
|
|
</ConnectTabContent>
|
|
|
|
<ConnectTabContent value="utils/supabase.ts">
|
|
<SimpleCodeBlock className="ts" parentClassName="min-h-72">
|
|
{`
|
|
import { createClient } from "@supabase/supabase-js";
|
|
|
|
const supabaseUrl = process.env.SUPABASE_URL;
|
|
const supabaseKey = process.env.SUPABASE_ANON_KEY;
|
|
|
|
export const supabase = createClient(supabaseUrl, supabaseKey);
|
|
`}
|
|
</SimpleCodeBlock>
|
|
</ConnectTabContent>
|
|
|
|
<ConnectTabContent value="src/App.jsx">
|
|
<SimpleCodeBlock className="jsx" parentClassName="min-h-72">
|
|
{`
|
|
import { supabase } from '../utils/supabase'
|
|
import { createResource, For } from "solid-js";
|
|
|
|
async function getTodos() {
|
|
const { data: todos } = await supabase.from("todos").select();
|
|
return data;
|
|
}
|
|
|
|
function App() {
|
|
const [todos] = createResource(getTodos);
|
|
|
|
return (
|
|
<ul>
|
|
<For each={todos()}>{(country) => <li>{todo.name}</li>}</For>
|
|
</ul>
|
|
);
|
|
}
|
|
|
|
export default App;
|
|
`}
|
|
</SimpleCodeBlock>
|
|
</ConnectTabContent>
|
|
</ConnectTabs>
|
|
)
|
|
}
|
|
|
|
export default ContentFile
|