Skip to content

Commit

Permalink
feat!: support @sanity/ui v2, and ship modern ESM (#16)
Browse files Browse the repository at this point in the history
* feat!: support `@sanity/ui` v2, and ship modern ESM

* fix: incorrect type export

* chore: publish new canary

---------

Co-authored-by: Tom Smith <tom@sanity.io>
  • Loading branch information
stipsan and thebiggianthead authored Apr 25, 2024
1 parent ffef7fc commit cc7d60a
Show file tree
Hide file tree
Showing 13 changed files with 16,130 additions and 26,561 deletions.
12 changes: 10 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@
"browser": true
},
"extends": [
"sanity",
"sanity/typescript",
"sanity/react",
"plugin:react-hooks/recommended",
"plugin:prettier/recommended"
],
"overrides": [
{
"files": ["*.{ts,tsx}"],
"rules": {
"no-undef": 0,
"dot-notation": 0
}
}
]
}
}
5 changes: 1 addition & 4 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>sanity-io/renovate-config",
"github>sanity-io/renovate-config:studio-v3"
]
"extends": ["github>sanity-io/renovate-config", "github>sanity-io/renovate-config:studio-v3"]
}
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
pull_request:
# Build on commits pushed to branches without a PR if it's in the allowlist
push:
branches: [main,v3]
branches: [main, v3]
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
workflow_dispatch:
inputs:
Expand Down
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

6 changes: 0 additions & 6 deletions .prettierrc.json

This file was deleted.

31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ React hooks and UI for reading and managing secrets in a Sanity Studio. This is

## Caveat

This plugin stores secrets as fields on a document in your dataset.
Even though that document is not accessible without having the correct permissions
This plugin stores secrets as fields on a document in your dataset.
Even though that document is not accessible without having the correct permissions
(logged in user with read access) it will be included in any export your may do of your dataset and this is important to be aware of.

## Future deprecation
Expand All @@ -35,40 +35,39 @@ Quick example of both using the secrets and putting up a dialog to let user ente
import {useEffect, useState} from 'react'
import {useSecrets, SettingsView} from '@sanity/studio-secrets'

const namespace = "myPlugin";
const namespace = 'myPlugin'

const pluginConfigKeys = [
{
key: "apiKey",
title: "Your secret API key",
key: 'apiKey',
title: 'Your secret API key',
},
];
]

const MyComponent = () => {
const { secrets } = useSecrets(namespace);
const [showSettings, setShowSettings] = useState(false);
const {secrets} = useSecrets(namespace)
const [showSettings, setShowSettings] = useState(false)

useEffect(() => {
if (!secrets) {
setShowSettings(true);
setShowSettings(true)
}
}, [secrets]);
}, [secrets])

if (!showSettings) {
return null;
return null
}
return (
<SettingsView
title={"sdfds"}
title={'sdfds'}
namespace={namespace}
keys={pluginConfigKeys}
onClose={() => {
setShowSettings(false);
setShowSettings(false)
}}
/>
);
};

)
}
```

## License
Expand Down
Loading

0 comments on commit cc7d60a

Please sign in to comment.