Commit 681c0552 authored by Rob's avatar Rob Committed by Tim Neutkens

Changed code to use the new css & asset imports instead of loading the whole lib from CDN (#3884)

* Changed code to use the new css & asset imports instead of loading the whole lib from CDN.

* Fixed formatting.
parent 1a51d11e
......@@ -37,5 +37,4 @@ now
## The idea behind the example
This example shows how to use Next.js along with [Semantic UI React](http://react.semantic-ui.com). This is intended to show the integration of this
UI toolkit with the Framework,
\ No newline at end of file
This example shows how to use Next.js along with [Semantic UI React](http://react.semantic-ui.com) including handling of external styles and assets. This is intended to show the integration of this UI toolkit with the Framework.
const withCss = require('@zeit/next-css')
module.exports = withCss({
webpack (config) {
config.module.rules.push({
test: /\.(png|svg|eot|otf|ttf|woff|woff2)$/,
use: {
loader: 'url-loader',
options: {
limit: 100000,
publicPath: './',
outputPath: 'static/',
name: '[name].[ext]'
}
}
})
return config
}
})
......@@ -7,10 +7,14 @@
"start": "next start"
},
"dependencies": {
"@zeit/next-css": "^0.1.2",
"file-loader": "^1.1.9",
"next": "latest",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"semantic-ui-react": "^0.68.0"
"semantic-ui-css": "^2.2.12",
"semantic-ui-react": "^0.78.2",
"url-loader": "^0.6.2"
},
"license": "ISC"
}
import 'semantic-ui-css/components/modal.css'
import 'semantic-ui-css/components/header.css'
import 'semantic-ui-css/components/button.css'
import 'semantic-ui-css/components/list.css'
import 'semantic-ui-css/components/icon.css'
import 'semantic-ui-css/themes/default/assets/fonts/icons.eot'
import 'semantic-ui-css/themes/default/assets/fonts/icons.woff'
import 'semantic-ui-css/themes/default/assets/fonts/icons.woff2'
import { Modal, Header, Button, List, Icon } from 'semantic-ui-react'
import Head from 'next/head'
import { Modal, Header, Button, List } from 'semantic-ui-react'
export default () => (
<div>
<Head>
<link rel='stylesheet' href='//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.2/semantic.min.css' />
<link rel='stylesheet' href='/_next/static/style.css' />
</Head>
<Modal trigger={<Button>Show Modal</Button>}>
<Modal.Header>Select a Photo</Modal.Header>
......@@ -34,5 +42,7 @@ export default () => (
</List.Content>
</List.Item>
</List>
Hello <Icon name='world' />
</div>
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment