Comments (2)
Hi @JamesGriz will have a look at this in the upcoming weeks
from sanity-plugin-icon-picker.
Hi @JamesGriz! It seems to me based on the npx sanity-codegen
script you ran that you're using the v2 version of the sanity-codegen and that you're using a sanity v3 studio based on the usage of defineField
.
I tried installing/running sanity-codegen based on the instructions here (alpha version) which supports v3 projects and it generated the types for me correctly in my v3 sanity studio project.
This was my test setup:
./package.json
{
"name": "sanity-project",
"private": true,
"version": "1.0.0",
"main": "package.json",
"license": "UNLICENSED",
"scripts": {
"dev": "sanity dev",
"start": "sanity start",
"build": "sanity build",
"deploy": "sanity deploy",
"deploy-graphql": "sanity graphql deploy"
},
"keywords": [
"sanity"
],
"dependencies": {
"@fortawesome/free-brands-svg-icons": "^6.4.2",
"@fortawesome/react-fontawesome": "^0.2.0",
"@sanity/vision": "^3.14.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-is": "^18.2.0",
"sanity": "^3.14.5",
"sanity-plugin-icon-picker": "^3.2.2",
"styled-components": "^5.3.9"
},
"devDependencies": {
"@sanity/eslint-config-studio": "^3.0.0",
"@types/react": "^18.0.25",
"@types/styled-components": "^5.1.26",
"eslint": "^8.6.0",
"sanity-codegen": "^1.0.0-alpha.45",
"typescript": "^4.9.5"
},
"prettier": {
"semi": false,
"printWidth": 100,
"bracketSpacing": false,
"singleQuote": true
}
}
./schemas/index.tsx
import React from 'react'
import {defineField} from 'sanity'
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'
import {
faSquareFacebook,
faInstagram,
faLinkedin,
faTwitter,
} from '@fortawesome/free-brands-svg-icons'
const icons = {
squareFacebook: faSquareFacebook,
instagram: faInstagram,
linkedin: faLinkedin,
twitter: faTwitter,
}
export const schemaTypes = [
{
title: 'Icons',
name: 'icons',
type: 'document',
fields: [
defineField({
title: 'Icon',
name: 'icon',
type: 'iconPicker',
options: {
configurations: [
{
title: 'FA Solid Icons',
provider: 'fa-pro',
icons: () =>
Object.entries(icons).map(([name, Component]) => {
return {
name,
component: () => (
<div
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
width: '25px',
height: '25px',
}}
>
<FontAwesomeIcon icon={Component} />
</div>
),
tags: [name],
}
}),
},
],
},
}),
],
},
]
As specified I then installed sanity-codegen npm i --save-dev sanity-codegen@alpha
and generated the types using npx sanity-codegen codegen
.
from sanity-plugin-icon-picker.
Related Issues (20)
- Icons are a bit cut of HOT 2
- DeprecationWarning: Invalid `main` field HOT 4
- Sanity V3 Upgrade? HOT 9
- Output format for react does not work in V3 HOT 4
- Next.js embedded Studio: Global CSS cannot be imported from within node_modules. HOT 2
- Deploying NextJS embedded studio breaks studio HOT 1
- Don't show tabs if only one provider is set
- Global css cannot be imported from within node_modules error HOT 5
- Large front-end bundles? HOT 17
- Stored SVG is not available in GraphQL HOT 5
- Building Next.js app with nested Sanity Studio is broken by the plugin HOT 2
- Application error: a client-side exception has occurred (see the browser console for more information). HOT 2
- Preview module does not work with custom providers HOT 2
- Error on production and built but not on development HOT 1
- Support for font awesome 6 HOT 1
- Read-only field HOT 7
- Tree shaking is not possible HOT 4
- Icons are cut off in MenuButton
- Translate the strings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sanity-plugin-icon-picker.