@@ -34,11 +34,11 @@ const getOperationWithFragments = (
3434
3535export type YogaGraphiQLProps = Partial < GraphiQLProps > &
3636 Partial < Omit < LoadFromUrlOptions , 'headers' > > & {
37- title ?: string ;
37+ title ?: string | React . ReactNode ;
3838 /**
3939 * Logo to be displayed in the top right corner
4040 */
41- logo ?: React . ReactNode ;
41+ logo ?: string | React . ReactNode ;
4242 /**
4343 * Extra headers you always want to pass with users' headers input
4444 */
@@ -172,16 +172,31 @@ export function YogaGraphiQL(props: YogaGraphiQLProps): React.ReactElement {
172172 >
173173 < GraphiQL . Logo >
174174 < div style = { { display : 'flex' , alignItems : 'center' } } >
175- < div style = { { width : 40 , display : 'flex' } } > { props ?. logo || < YogaLogo /> } </ div >
176- < span >
177- { props ?. title || (
178- < >
179- Yoga Graph
180- < em > i</ em >
181- QL
182- </ >
183- ) }
184- </ span >
175+ { typeof props ?. logo === 'string' ? (
176+ // if the logo is a string, then it's coming when rendering graphiql as a static page (see render-graphiql)
177+ < div
178+ style = { { width : 40 , display : 'flex' } }
179+ dangerouslySetInnerHTML = { { __html : props . logo } }
180+ />
181+ ) : (
182+ // otherwise, it's used inside react and we can render it as a component
183+ < div style = { { width : 40 , display : 'flex' } } > { props ?. logo || < YogaLogo /> } </ div >
184+ ) }
185+ { typeof props ?. title === 'string' ? (
186+ // if the title is a string, then it's coming when rendering graphiql as a static page (see render-graphiql)
187+ < span dangerouslySetInnerHTML = { { __html : props . title } } />
188+ ) : (
189+ // otherwise, it's used inside react and we can render it as a component
190+ < span >
191+ { props ?. title || (
192+ < >
193+ Yoga Graph
194+ < em > i</ em >
195+ QL
196+ </ >
197+ ) }
198+ </ span >
199+ ) }
185200 </ div >
186201 </ GraphiQL . Logo >
187202 </ GraphiQLInterface >
0 commit comments