Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: support @sanity/ui v2, and ship modern ESM #16

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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