@sanity/sdk-react 0.0.0-alpha.17 → 0.0.0-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -45,110 +45,24 @@ npm run dev
45
45
  4. Open the App in Sanity Dashboard with your organization ID
46
46
 
47
47
  ```
48
- https://core.sanity.io/<your-organization-id>?dev=localhost:5173
48
+ https://core.sanity.io/<your-organization-id>?dev=http://localhost:3333
49
49
  ```
50
50
 
51
- 5. Overwrite the `src/App.tsx` file with the following code:
51
+ 5. Update the `src/App.tsx` file with your Sanity project and dataset
52
52
 
53
53
  ```tsx
54
54
  // src/App.tsx
55
- import {SanityConfig} from '@sanity/sdk'
56
- import {SanityApp} from '@sanity/sdk-react/components'
57
- import {useCurrentUser, useLogOut} from '@sanity/sdk-react/hooks'
58
-
59
- import './App.css'
55
+ import {createSanityInstance} from '@sanity/sdk'
56
+ ...
60
57
 
61
58
  const sanityConfig: SanityConfigs = [
62
59
  {
63
- projectId: '<your-project-id>',
64
- dataset: '<your-dataset>',
60
+ projectId: 'abc123',
61
+ dataset: 'production',
65
62
  },
66
63
  ]
67
64
 
68
- export function App(): JSX.Element {
69
- return (
70
- <SanityApp sanityConfigs={sanityConfigs}>
71
- <MyApp />
72
- </SanityApp>
73
- )
74
- }
75
-
76
- function MyApp() {
77
- const currentUser = useCurrentUser()
78
- const logout = useLogOut()
79
-
80
- return (
81
- <div>
82
- <h1>Hello, {currentUser?.name}!</h1>
83
- <button onClick={logout}>Logout</button>
84
- </div>
85
- )
86
- }
87
-
88
- export default App
89
- ```
90
-
91
- 6. Overwrite the `src/App.css` file with the following code:
92
-
93
- ```css
94
- /* src/App.css */
95
- #root {
96
- margin: auto;
97
- }
98
-
99
- .sc-login-layout {
100
- min-height: 100vh;
101
- display: flex;
102
- background: #f3f3f3;
103
- }
104
-
105
- .sc-login-layout__container {
106
- margin: auto;
107
- padding: 2rem;
108
- }
109
-
110
- .sc-login-layout__card {
111
- background: white;
112
- padding: 2rem;
113
- }
114
-
115
- .sc-login__title,
116
- .sc-login-callback {
117
- text-align: center;
118
- margin-bottom: 2rem;
119
- color: #333;
120
- }
121
-
122
- .sc-login-providers {
123
- display: flex;
124
- flex-direction: column;
125
- gap: 1rem;
126
- }
127
-
128
- .sc-login-providers a {
129
- padding: 0.8rem;
130
- border: 1px solid #ddd;
131
- text-decoration: none;
132
- color: #333;
133
- text-align: center;
134
- }
135
-
136
- .sc-login-footer {
137
- margin-top: 2rem;
138
- text-align: center;
139
- }
140
-
141
- .sc-login-footer__links {
142
- list-style: none;
143
- padding: 0;
144
- display: flex;
145
- justify-content: center;
146
- gap: 1.5rem;
147
- }
148
-
149
- .sc-login-footer__link a {
150
- font-size: 0.9rem;
151
- }
65
+ ...
152
66
  ```
153
67
 
154
68
  ## License