Download wp-calypso/client/reader/components/favicon/index.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 565 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/reader/components/favicon/index.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/reader/components/favicon/index.js
-
curl -L -o index.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/reader/components/favicon/index.js
565 Bytes
| import { Gridicon } from '@automattic/components'; | |
| import { useState } from 'react'; | |
| function Favicon( props ) { | |
| const { site, className, size } = props; | |
| const [ hasError, setError ] = useState( false ); | |
| // if loading error or missing icon show W Gridicon | |
| if ( hasError || site.site_icon === null ) { | |
| return <Gridicon icon="globe" size={ size } className={ props.className } />; | |
| } | |
| return ( | |
| <img | |
| onError={ setError } | |
| src={ site.site_icon } | |
| className={ className } | |
| width={ size } | |
| alt={ site.site_icon } | |
| /> | |
| ); | |
| } | |
| export default Favicon; | |