nitro-web 0.0.14 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_example/client/index.ts +0 -1
- package/_example/components/index.tsx +10 -4
- package/_example/tailwind.config.js +3 -3
- package/client/index.ts +3 -0
- package/components/auth/signup.tsx +2 -2
- package/components/dashboard/dashboard.tsx +3 -3
- package/components/partials/element/sidebar.tsx +3 -2
- package/components/partials/styleguide.tsx +3 -3
- package/components/settings/settings-account.tsx +2 -2
- package/components/settings/settings-business.tsx +1 -1
- package/components/settings/settings-team--member.tsx +2 -2
- package/package.json +4 -4
- package/readme.md +1 -1
- package/types/required-globals.d.ts +1 -0
- package/webpack.config.js +1 -5
package/_example/client/index.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { css, theme } from 'twin.macro'
|
|
6
6
|
import config from '../client/config'
|
|
7
|
+
import { isDemo } from 'nitro-web'
|
|
7
8
|
import {
|
|
8
9
|
Signin,
|
|
9
10
|
Signup,
|
|
@@ -79,7 +80,7 @@ DashboardPage.route = {
|
|
|
79
80
|
export const StyleguidePage = () => <Styleguide config={config} />
|
|
80
81
|
StyleguidePage.route = {
|
|
81
82
|
'/styleguide': true,
|
|
82
|
-
'meta': { title: 'Style Guide - Nitro
|
|
83
|
+
'meta': { title: `${isDemo ? 'Design System' : 'Style Guide'} - Nitro`, layout: 1 },
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
// Not found page
|
|
@@ -139,9 +140,14 @@ export function PricingPage() {
|
|
|
139
140
|
Choose the right plan for you
|
|
140
141
|
</p>
|
|
141
142
|
</div>
|
|
142
|
-
<p className="mx-auto mt-6 max-w-
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
<p className="mx-auto mt-6 max-w-3xl text-pretty text-center text-lg font-medium text-gray-600 sm:text-xl/8">
|
|
144
|
+
This is a
|
|
145
|
+
<a class="underline" href="https://tailwindui.com/components/marketing/sections/pricing" target="_blank" rel="noreferrer">
|
|
146
|
+
pricing page
|
|
147
|
+
</a> example using one of the
|
|
148
|
+
<a class="underline" href="https://tailwindui.com/components" target="_blank" rel="noreferrer">
|
|
149
|
+
Tailwind UI
|
|
150
|
+
</a> components. With minor composition changes, it's almost copy/paste.
|
|
145
151
|
</p>
|
|
146
152
|
<div className="mx-auto mt-16 grid max-w-lg grid-cols-1 items-center gap-y-6 sm:mt-20 sm:gap-y-0 lg:max-w-4xl lg:grid-cols-2">
|
|
147
153
|
{tiers.map((tier, tierIdx) => (
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L889
|
|
2
1
|
import defaultTheme from 'tailwindcss/defaultTheme'
|
|
3
2
|
import colors from 'tailwindcss/colors'
|
|
4
3
|
import path from 'path'
|
|
5
4
|
import Color from 'color'
|
|
5
|
+
|
|
6
6
|
const lighten = (clr, val) => Color(clr).lighten(val).rgb().string()
|
|
7
7
|
const nitroDir = path.dirname(require.resolve('nitro-web'))
|
|
8
8
|
|
|
@@ -15,11 +15,11 @@ export default {
|
|
|
15
15
|
],
|
|
16
16
|
},
|
|
17
17
|
experimental: {
|
|
18
|
-
optimizeUniversalDefaults: true, // remove
|
|
18
|
+
optimizeUniversalDefaults: true, // remove undesired variables from universal selectors
|
|
19
19
|
},
|
|
20
20
|
theme: {
|
|
21
|
+
// Full list: https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L889
|
|
21
22
|
extend: {
|
|
22
|
-
// Nitro theme variables
|
|
23
23
|
boxShadow: {
|
|
24
24
|
'dropdown-ul': '0 2px 8px 0 rgba(0, 0, 0, 0.05)',
|
|
25
25
|
},
|
package/client/index.ts
CHANGED
|
@@ -32,11 +32,11 @@ export function Signup({ config }: { config: Config}) {
|
|
|
32
32
|
<div class="grid grid-cols-2 gap-6">
|
|
33
33
|
<div>
|
|
34
34
|
<label for="name">Your Name</label>
|
|
35
|
-
<Input name="name" placeholder="E.g.
|
|
35
|
+
<Input name="name" placeholder="E.g. Bruce Wayne" state={state} onChange={onChange.bind(setState)} />
|
|
36
36
|
</div>
|
|
37
37
|
<div>
|
|
38
38
|
<label for="business.name">Company Name</label>
|
|
39
|
-
<Input name="business.name" placeholder="E.g.
|
|
39
|
+
<Input name="business.name" placeholder="E.g. Wayne Enterprises" state={state} onChange={onChange.bind(setState)} />
|
|
40
40
|
</div>
|
|
41
41
|
</div>
|
|
42
42
|
<div>
|
|
@@ -2,9 +2,9 @@ import { css, theme } from 'twin.macro'
|
|
|
2
2
|
|
|
3
3
|
export function Dashboard({ config }: { config: { isStatic?: boolean } }) {
|
|
4
4
|
const [store] = useTracked()
|
|
5
|
-
const textColor = store.apiAvailable ? 'text-green-700' : 'text-pink-700'
|
|
6
|
-
const fillColor = store.apiAvailable ? 'fill-green-500' : 'fill-pink-500'
|
|
7
|
-
const bgColor = store.apiAvailable ? 'bg-green-100' : 'bg-pink-100'
|
|
5
|
+
const textColor = store.apiAvailable ? 'text-green-700' : config.isStatic ? 'text-gray-700' : 'text-pink-700'
|
|
6
|
+
const fillColor = store.apiAvailable ? 'fill-green-500' : config.isStatic ? 'fill-gray-500' : 'fill-pink-500'
|
|
7
|
+
const bgColor = store.apiAvailable ? 'bg-green-100' : config.isStatic ? 'bg-[#eeeeee]' : 'bg-pink-100'
|
|
8
8
|
|
|
9
9
|
return (
|
|
10
10
|
<div css={style}>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Component: https://tailwindui.com/components/application-ui/application-shells/sidebar#component-a69d85b6237ea2ad506c00ef1cd39a38
|
|
2
2
|
import { Dialog, DialogBackdrop, DialogPanel, TransitionChild } from '@headlessui/react'
|
|
3
3
|
import avatarImg from 'nitro-web/client/imgs/avatar.jpg'
|
|
4
|
+
import { isDemo } from 'nitro-web'
|
|
4
5
|
import {
|
|
5
6
|
Bars3Icon,
|
|
6
7
|
HomeIcon,
|
|
@@ -84,8 +85,8 @@ function SidebarContents ({ Logo, menu, links }: SidebarProps) {
|
|
|
84
85
|
|
|
85
86
|
const _menu = menu || [
|
|
86
87
|
{ name: 'Dashboard', to: '/', Icon: HomeIcon },
|
|
87
|
-
{ name: '
|
|
88
|
-
{ name: 'Pricing
|
|
88
|
+
{ name: isDemo ? 'Design System' : 'Style Guide', to: '/styleguide', Icon: PaintBrushIcon },
|
|
89
|
+
{ name: 'Pricing', to: '/pricing', Icon: UsersIcon },
|
|
89
90
|
{ name: 'Signout', to: '/signout', Icon: ArrowLeftCircleIcon },
|
|
90
91
|
]
|
|
91
92
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Drop, Dropdown, Input, Select, Button, Checkbox, GithubLink } from 'nitro-web'
|
|
1
|
+
import { Drop, Dropdown, Input, Select, Button, Checkbox, GithubLink, isDemo } from 'nitro-web'
|
|
2
2
|
import { getCountryOptions, getCurrencyOptions, ucFirst } from 'nitro-web/util'
|
|
3
3
|
import { CheckIcon } from '@heroicons/react/20/solid'
|
|
4
4
|
import { Config } from 'types'
|
|
@@ -11,7 +11,7 @@ export function Styleguide({ config }: { config: Config }) {
|
|
|
11
11
|
currency: 'nzd', // can be commented too
|
|
12
12
|
amount: 100,
|
|
13
13
|
brandColor: '#F3CA5F',
|
|
14
|
-
firstName: '
|
|
14
|
+
firstName: 'Bruce',
|
|
15
15
|
date: Date.now(),
|
|
16
16
|
errors: [
|
|
17
17
|
{ title: 'address', detail: 'Address is required' },
|
|
@@ -52,7 +52,7 @@ export function Styleguide({ config }: { config: Config }) {
|
|
|
52
52
|
<div class="mb-10 text-left max-w-[1100px]">
|
|
53
53
|
<GithubLink filename={__filename} />
|
|
54
54
|
<div class="mb-7">
|
|
55
|
-
<h1 class="h1">
|
|
55
|
+
<h1 class="h1">{isDemo ? 'Design System' : 'Style Guide'}</h1>
|
|
56
56
|
<p>
|
|
57
57
|
Components are styled using
|
|
58
58
|
<a href="https://v3.tailwindcss.com/docs/configuration" class="underline" target="_blank" rel="noreferrer">TailwindCSS</a>.
|
|
@@ -48,11 +48,11 @@ export function SettingsAccount() {
|
|
|
48
48
|
<div class="cols cols-6 cols-gap-3">
|
|
49
49
|
<div class="col">
|
|
50
50
|
<label for="firstName">First Name(s)</label>
|
|
51
|
-
<Input name="firstName" placeholder="E.g.
|
|
51
|
+
<Input name="firstName" placeholder="E.g. Bruce" state={state} onChange={onChange(setState)} />
|
|
52
52
|
</div>
|
|
53
53
|
<div class="col">
|
|
54
54
|
<label for="lastName">Last Name</label>
|
|
55
|
-
<Input name="lastName" placeholder="E.g.
|
|
55
|
+
<Input name="lastName" placeholder="E.g. Wayne" state={state} onChange={onChange(setState)} />
|
|
56
56
|
</div>
|
|
57
57
|
<div class="col">
|
|
58
58
|
<label for="email">Email Address</label>
|
|
@@ -80,7 +80,7 @@ export function SettingsBusiness({ config }) {
|
|
|
80
80
|
</div>
|
|
81
81
|
<div class="col">
|
|
82
82
|
<label for="business.name">Trading Name</label>
|
|
83
|
-
<Input name="business.name" placeholder="E.g.
|
|
83
|
+
<Input name="business.name" placeholder="E.g. Wayne Enterprises" state={state} onChange={onChange(setState)} />
|
|
84
84
|
</div>
|
|
85
85
|
<div class="col">
|
|
86
86
|
<Link to="#" class="label-right link2 underline2 is-active">Custom Address</Link>
|
|
@@ -72,11 +72,11 @@ export function SettingsTeamMember ({ showModal, setShowModal }) {
|
|
|
72
72
|
</div>
|
|
73
73
|
<div class="col">
|
|
74
74
|
<label for="firstName">First Name</label>
|
|
75
|
-
<Input name="firstName" placeholder="E.g.
|
|
75
|
+
<Input name="firstName" placeholder="E.g. Bruce" state={state} onChange={onChange(setState)} />
|
|
76
76
|
</div>
|
|
77
77
|
<div class="col">
|
|
78
78
|
<label for="lastName">Last Name</label>
|
|
79
|
-
<Input name="lastName" placeholder="E.g.
|
|
79
|
+
<Input name="lastName" placeholder="E.g. Wayne" state={state} onChange={onChange(setState)} />
|
|
80
80
|
</div>
|
|
81
81
|
<div class="col-12">
|
|
82
82
|
<label for="message">Invitation Message</label>
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Nitro is a battle-tested, modular base project to turbocharge your projects, styled using Tailwind 🚀",
|
|
4
4
|
"repository": "github:boycce/nitro-web",
|
|
5
5
|
"homepage": "https://boycce.github.io/nitro-web/",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.16",
|
|
7
7
|
"main": "./client/index.ts",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"keywords": [
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"dev": "npm run dev -w example",
|
|
38
|
-
"dev:client": "npm run dev:client -w example",
|
|
39
|
-
"dev:client-only": "isStatic=true npm run dev:client -w example",
|
|
38
|
+
"dev:client": "isDemo=true npm run dev:client -w example",
|
|
39
|
+
"dev:client-only": "isDemo=true isStatic=true npm run dev:client -w example",
|
|
40
40
|
"dev:server": "npm run dev:server -w example",
|
|
41
|
-
"build": "isStatic=true npm run build -w example",
|
|
41
|
+
"build": "isDemo=true isStatic=true npm run build -w example",
|
|
42
42
|
"major": "npm run types && standard-version --release-as major && npm publish",
|
|
43
43
|
"minor": "npm run types && standard-version --release-as minor && npm publish",
|
|
44
44
|
"patch": "npm run types && standard-version --release-as patch && npm publish",
|
package/readme.md
CHANGED
|
@@ -11,7 +11,7 @@ npm i nitro-web
|
|
|
11
11
|
### Install
|
|
12
12
|
|
|
13
13
|
1. Copy ./_example into your project
|
|
14
|
-
2. In package.json, replace `"nitro-web": "file:.."` with `"nitro-web": "~0.0.
|
|
14
|
+
2. In package.json, replace `"nitro-web": "file:.."` with `"nitro-web": "~0.0.16"`
|
|
15
15
|
3. In package.json, replace `"../.eslintrc.json"` with `"./node_modules/nitro-web/.eslintrc.json"`
|
|
16
16
|
4. Run `npm i`
|
|
17
17
|
|
|
@@ -7,6 +7,7 @@ import { CSSInterpolation } from '@emotion/serialize'
|
|
|
7
7
|
declare global {
|
|
8
8
|
/** Webpack injected config variables */
|
|
9
9
|
const INJECTED: Record<string, string|boolean|object>
|
|
10
|
+
const ISDEMO: boolean
|
|
10
11
|
/** Webpack svg loader */
|
|
11
12
|
module '*.svg' {
|
|
12
13
|
const content: React.FC<React.SVGProps<SVGElement>>
|
package/webpack.config.js
CHANGED
|
@@ -161,11 +161,6 @@ export const getConfig = (config) => {
|
|
|
161
161
|
replace: 'if (false && unsafePseudoClasses',
|
|
162
162
|
},
|
|
163
163
|
},
|
|
164
|
-
{
|
|
165
|
-
test: /styleguide\.html$/i,
|
|
166
|
-
exclude: [/\/server\/email/],
|
|
167
|
-
loader: 'html-loader',
|
|
168
|
-
},
|
|
169
164
|
{
|
|
170
165
|
test: /\.csv$/,
|
|
171
166
|
use: [
|
|
@@ -278,6 +273,7 @@ export const getConfig = (config) => {
|
|
|
278
273
|
],
|
|
279
274
|
}),
|
|
280
275
|
new webpack.DefinePlugin({
|
|
276
|
+
ISDEMO: !!process.env.isDemo,
|
|
281
277
|
INJECTED: JSON.stringify({
|
|
282
278
|
...pick(config, config.inject ? config.inject.split(' ') : []),
|
|
283
279
|
}),
|