nitro-web 0.0.15 → 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.
@@ -8,4 +8,3 @@ import { Layout1, Layout2 } from '../components/partials/layouts'
8
8
 
9
9
  // Auto-import page components, initilize app, and run config.beforeApp
10
10
  setupApp(config, [Layout1, Layout2])
11
-
@@ -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', layout: 1 },
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-2xl text-pretty text-center text-lg font-medium text-gray-600 sm:text-xl/8">
143
- Choose an affordable plan that’s packed with the best features for engaging your audience, creating customer
144
- loyalty, and driving sales.
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&nbsp;
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&nbsp;
148
+ <a class="underline" href="https://tailwindui.com/components" target="_blank" rel="noreferrer">
149
+ Tailwind UI
150
+ </a> components. With minor composition changes, it&apos;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 unneeded varables from universal selectors
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
@@ -50,3 +50,6 @@ export { Layout2 } from '../components/partials/layout/layout2'
50
50
 
51
51
  // Component Other
52
52
  export { IsFirstRender } from '../components/partials/is-first-render'
53
+
54
+ // IsDemo environment variable
55
+ export const isDemo = ISDEMO
@@ -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: 'Styleguide', to: '/styleguide', Icon: PaintBrushIcon },
88
- { name: 'Pricing (example)', to: '/pricing', Icon: UsersIcon },
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'
@@ -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">Styleguide</h1>
55
+ <h1 class="h1">{isDemo ? 'Design System' : 'Style Guide'}</h1>
56
56
  <p>
57
57
  Components are styled using&nbsp;
58
58
  <a href="https://v3.tailwindcss.com/docs/configuration" class="underline" target="_blank" rel="noreferrer">TailwindCSS</a>.
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.15",
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.15"`
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
  }),