Ver código fonte

Update kitchen sink

Make templates work with both Remix and Next.
master
TheoryOfNekomata 1 ano atrás
pai
commit
97e70bc895
45 arquivos alterados com 564 adições e 18034 exclusões
  1. +0
    -3400
      packages/base/yarn.lock
  2. +1
    -4
      packages/kitchen-sink/react-next/.eslintrc.json
  3. +0
    -1
      packages/kitchen-sink/react-next/.gitignore
  4. +4
    -0
      packages/kitchen-sink/react-next/README.md
  5. +0
    -4
      packages/kitchen-sink/react-next/next.config.js
  6. +10
    -14
      packages/kitchen-sink/react-next/package.json
  7. BIN
      packages/kitchen-sink/react-next/public/favicon.ico
  8. +1
    -0
      packages/kitchen-sink/react-next/public/next.svg
  9. +1
    -4
      packages/kitchen-sink/react-next/public/vercel.svg
  10. +0
    -25
      packages/kitchen-sink/react-next/src/components/Brand/Brand.module.css
  11. +2
    -3
      packages/kitchen-sink/react-next/src/components/Brand/index.tsx
  12. +1
    -5
      packages/kitchen-sink/react-next/src/pages/_app.tsx
  13. +13
    -0
      packages/kitchen-sink/react-next/src/pages/_document.tsx
  14. +0
    -13
      packages/kitchen-sink/react-next/src/pages/api/hello.ts
  15. +2
    -2
      packages/kitchen-sink/react-next/src/pages/layouts/basic.tsx
  16. +2
    -3
      packages/kitchen-sink/react-next/src/pages/layouts/left-sidebar-with-menu.tsx
  17. +2
    -2
      packages/kitchen-sink/react-next/src/pages/layouts/left-sidebar.tsx
  18. +2
    -2
      packages/kitchen-sink/react-next/src/pages/layouts/left-sidebar/alternate.tsx
  19. +2
    -2
      packages/kitchen-sink/react-next/src/pages/layouts/right-sidebar-static.tsx
  20. +0
    -0
      packages/kitchen-sink/react-next/src/styles/globals.css
  21. +4
    -6
      packages/kitchen-sink/react-next/tailwind.config.js
  22. +15
    -4
      packages/kitchen-sink/react-next/tsconfig.json
  23. +0
    -2486
      packages/kitchen-sink/react-next/yarn.lock
  24. +0
    -25
      packages/kitchen-sink/react-remix/app/components/Brand/Brand.module.css
  25. +2
    -3
      packages/kitchen-sink/react-remix/app/components/Brand/index.tsx
  26. +0
    -5
      packages/kitchen-sink/react-remix/app/root.tsx
  27. +0
    -7
      packages/kitchen-sink/react-remix/app/routes/_index.tsx
  28. +6
    -8
      packages/kitchen-sink/react-remix/app/routes/layouts.basic.tsx
  29. +198
    -66
      packages/kitchen-sink/react-remix/app/routes/layouts.left-sidebar-with-menu.tsx
  30. +4
    -6
      packages/kitchen-sink/react-remix/app/routes/layouts.left-sidebar.tsx
  31. +5
    -8
      packages/kitchen-sink/react-remix/app/routes/layouts.right-sidebar-static.tsx
  32. +3
    -41
      packages/kitchen-sink/react-remix/app/style.css
  33. +2
    -1
      packages/kitchen-sink/react-remix/package.json
  34. +6
    -0
      packages/kitchen-sink/react-remix/postcss.config.js
  35. +1
    -0
      packages/kitchen-sink/react-remix/remix.config.js
  36. +12
    -0
      packages/kitchen-sink/react-remix/tailwind.config.js
  37. +0
    -3
      packages/kitchen-sink/react-remix/tsconfig.json
  38. +0
    -7288
      packages/kitchen-sink/react-remix/yarn.lock
  39. +1
    -1
      packages/react/src/layouts/Basic/index.tsx
  40. +1
    -1
      packages/react/src/layouts/LeftSidebarWithMenu/index.tsx
  41. +1
    -1
      packages/react/src/layouts/RightSidebarStatic/index.tsx
  42. +1
    -1
      packages/react/src/widgets/LeftSidebarWithMenuBase/index.tsx
  43. +1
    -1
      packages/react/src/widgets/TopBar/index.tsx
  44. +0
    -4110
      packages/react/yarn.lock
  45. +258
    -478
      pnpm-lock.yaml

+ 0
- 3400
packages/base/yarn.lock
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


+ 1
- 4
packages/kitchen-sink/react-next/.eslintrc.json Ver arquivo

@@ -1,6 +1,3 @@
{
"extends": "next/core-web-vitals",
"rules": {
"@next/next/no-html-link-for-pages": "off"
}
"extends": "next/core-web-vitals"
}

+ 0
- 1
packages/kitchen-sink/react-next/.gitignore Ver arquivo

@@ -23,7 +23,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local


+ 4
- 0
packages/kitchen-sink/react-next/README.md Ver arquivo

@@ -8,6 +8,8 @@ First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
@@ -18,6 +20,8 @@ You can start editing the page by modifying `pages/index.tsx`. The page auto-upd

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:


+ 0
- 4
packages/kitchen-sink/react-next/next.config.js Ver arquivo

@@ -1,10 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
experimental: {
optimizeCss: true,
},
}

module.exports = nextConfig

+ 10
- 14
packages/kitchen-sink/react-next/package.json Ver arquivo

@@ -1,5 +1,5 @@
{
"name": "@tesseract-design/viewfinder-kitchen-sink-react",
"name": "react-next",
"version": "0.1.0",
"private": true,
"scripts": {
@@ -9,23 +9,19 @@
"lint": "next lint"
},
"dependencies": {
"@tesseract-design/viewfinder-base": "workspace:*",
"@tesseract-design/viewfinder-react": "workspace:*",
"next": "12.2.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-markdown": "^8.0.6"
},
"devDependencies": {
"@types/node": "18.6.4",
"@types/react": "18.0.15",
"@tesseract-design/viewfinder-base": "workspace:*",
"@tesseract-design/viewfinder-react": "workspace:*",
"@types/node": "20.4.5",
"@types/react": "18.2.17",
"@types/react-dom": "18.0.6",
"autoprefixer": "^10.4.14",
"critters": "^0.0.19",
"eslint": "8.21.0",
"eslint": "8.46.0",
"eslint-config-next": "12.2.4",
"next": "12.2.4",
"postcss": "^8.4.27",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwindcss": "^3.3.3",
"typescript": "4.7.4"
"typescript": "5.1.6"
}
}

BIN
packages/kitchen-sink/react-next/public/favicon.ico Ver arquivo

Antes Depois

+ 1
- 0
packages/kitchen-sink/react-next/public/next.svg Ver arquivo

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>

+ 1
- 4
packages/kitchen-sink/react-next/public/vercel.svg Ver arquivo

@@ -1,4 +1 @@
<svg width="283" height="64" viewBox="0 0 283 64" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" fill="#000"/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>

+ 0
- 25
packages/kitchen-sink/react-next/src/components/Brand/Brand.module.css Ver arquivo

@@ -1,25 +0,0 @@
.brand-base {
display: block;
text-decoration: none;
font-size: 1.5rem;
font-weight: bold;
font-stretch: 75%;
text-transform: uppercase;
width: 2rem;
text-align: center;
}

.hide {
display: none;
}

@media (min-width: 720px) {
.brand-base {
width: 8rem;
text-align: left;
}

.hide {
display: inline;
}
}

+ 2
- 3
packages/kitchen-sink/react-next/src/components/Brand/index.tsx Ver arquivo

@@ -1,5 +1,4 @@
import Link from 'next/link'
import styles from './Brand.module.css'

export const Brand = () => (
<Link
@@ -8,10 +7,10 @@ export const Brand = () => (
>
<a
href="/"
className={styles['brand-base']}
className="block no-underline text-[1.5rem] font-bold uppercase w-8 text-center sm:text-left sm:w-auto"
>
B
<span className={styles.hide}>
<span className="hidden sm:inline">
rand
</span>
</a>


+ 1
- 5
packages/kitchen-sink/react-next/src/pages/_app.tsx Ver arquivo

@@ -1,11 +1,7 @@
import type { AppProps } from 'next/app'
// import { setup } from '@tesseract-design/viewfinder-react';
// import * as gooberPrefixer from 'goober/prefixer';
import * as React from 'react';

import '../tailwind.css';

// setup(React.createElement, gooberPrefixer.prefix);
import 'src/styles/globals.css';

const MyApp: React.FC<AppProps> = ({ Component, pageProps }) => <Component {...pageProps} />



+ 13
- 0
packages/kitchen-sink/react-next/src/pages/_document.tsx Ver arquivo

@@ -0,0 +1,13 @@
import { Html, Head, Main, NextScript } from 'next/document'

export default function Document() {
return (
<Html lang="en">
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
)
}

+ 0
- 13
packages/kitchen-sink/react-next/src/pages/api/hello.ts Ver arquivo

@@ -1,13 +0,0 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next'

type Data = {
name: string
}

export default function handler(
req: NextApiRequest,
res: NextApiResponse<Data>
) {
res.status(200).json({ name: 'John Doe' })
}

+ 2
- 2
packages/kitchen-sink/react-next/src/pages/layouts/basic.tsx Ver arquivo

@@ -1,8 +1,8 @@
import type {GetServerSideProps, NextPage} from 'next';
import ReactMarkdown from 'react-markdown';
import { Layouts, Widgets } from '@tesseract-design/viewfinder-react';
import {Brand} from '../../components/Brand';
import {Image} from '../../components/Image';
import {Brand} from 'src/components/Brand';
import {Image} from 'src/components/Image';
import Link from 'next/link';

type BaseLayoutPageProps = {


+ 2
- 3
packages/kitchen-sink/react-next/src/pages/layouts/left-sidebar-with-menu.tsx Ver arquivo

@@ -1,11 +1,10 @@
import type { NextPage } from 'next'
import { Layouts, Widgets } from '@tesseract-design/viewfinder-react';
import {Span} from '@tesseract-design/viewfinder-base';
import Link from 'next/link';
import {Brand} from '../../components/Brand';
import {Brand} from 'src/components/Brand';
import {GetServerSideProps} from 'next';
import {FC, ReactNode} from 'react';
import {Image} from '../../components/Image';
import {Image} from 'src/components/Image';
import ReactMarkdown from 'react-markdown';

type LeftSidebarWithMenuLayoutPageProps = {


+ 2
- 2
packages/kitchen-sink/react-next/src/pages/layouts/left-sidebar.tsx Ver arquivo

@@ -1,8 +1,8 @@
import type { NextPage } from 'next'
import { Layouts, Widgets } from '@tesseract-design/viewfinder-react';
import Link from 'next/link';
import {Brand} from '../../components/Brand';
import {Image} from '../../components/Image';
import {Brand} from 'src/components/Brand';
import {Image} from 'src/components/Image';
import ReactMarkdown from 'react-markdown';
import {GetServerSideProps} from 'next';



+ 2
- 2
packages/kitchen-sink/react-next/src/pages/layouts/left-sidebar/alternate.tsx Ver arquivo

@@ -1,10 +1,10 @@
import type { NextPage } from 'next'
import { Layouts, Widgets } from '@tesseract-design/viewfinder-react';
import Link from 'next/link';
import {Brand} from '../../../components/Brand';
import {Brand} from 'src/components/Brand';
import {GetServerSideProps} from 'next';
import {FC, ReactNode} from 'react';
import {Image} from '../../../components/Image';
import {Image} from 'src/components/Image';
import ReactMarkdown from 'react-markdown';

type LeftSidebarWithMenuLayoutPageProps = {


+ 2
- 2
packages/kitchen-sink/react-next/src/pages/layouts/right-sidebar-static.tsx Ver arquivo

@@ -1,7 +1,7 @@
import type { NextPage } from 'next'
import { Layouts, Widgets } from '@tesseract-design/viewfinder-react';
import {Brand} from '../../components/Brand';
import {Image} from '../../components/Image';
import {Brand} from 'src/components/Brand';
import {Image} from 'src/components/Image';
import ReactMarkdown from 'react-markdown';
import Link from 'next/link';



packages/kitchen-sink/react-next/src/tailwind.css → packages/kitchen-sink/react-next/src/styles/globals.css Ver arquivo


+ 4
- 6
packages/kitchen-sink/react-next/tailwind.config.js Ver arquivo

@@ -1,14 +1,12 @@
const { tailwind } = require('@tesseract-design/viewfinder-base');
const { plugin: viewfinderPlugin } = tailwind;

/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./src/components/**/*.tsx',
'./src/pages/**/*.tsx',
'./node_modules/@tesseract-design/viewfinder-react/dist/**/*.js',
],
'./src/**/*.{js,ts,jsx,tsx,mdx}',
'./node_modules/@tesseract-design/viewfinder-react/dist/**/*.js',
],
plugins: [
viewfinderPlugin(),
tailwind.plugin(),
],
}

+ 15
- 4
packages/kitchen-sink/react-next/tsconfig.json Ver arquivo

@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
@@ -13,8 +17,15 @@
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
"incremental": true,
"baseUrl": "."
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}

+ 0
- 2486
packages/kitchen-sink/react-next/yarn.lock
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


+ 0
- 25
packages/kitchen-sink/react-remix/app/components/Brand/Brand.module.css Ver arquivo

@@ -1,25 +0,0 @@
.brand-base {
display: block;
text-decoration: none;
font-size: 1.5rem;
font-weight: bold;
font-stretch: 75%;
text-transform: uppercase;
width: 2rem;
text-align: center;
}

.hide {
display: none;
}

@media (min-width: 720px) {
.brand-base {
width: 8rem;
text-align: left;
}

.hide {
display: inline;
}
}

+ 2
- 3
packages/kitchen-sink/react-remix/app/components/Brand/index.tsx Ver arquivo

@@ -1,13 +1,12 @@
import {Link} from "@remix-run/react"
import styles from './Brand.module.css'

export const Brand = () => (
<Link
to="/"
className={styles['brand-base']}
className="block no-underline text-[1.5rem] font-bold uppercase w-8 text-center sm:text-left sm:w-auto"
>
B
<span className={styles.hide}>
<span className="hidden sm:inline">
rand
</span>
</Link>


+ 0
- 5
packages/kitchen-sink/react-remix/app/root.tsx Ver arquivo

@@ -8,13 +8,9 @@ import {
} from "@remix-run/react";

import type {LinksFunction} from '@remix-run/node';
import { setup, extractCss } from '@tesseract-design/viewfinder-react';
import * as React from 'react';
import * as gooberPrefixer from 'goober/prefixer';
import globalStylesheetUrl from './style.css';

setup(React.createElement, gooberPrefixer.prefix);

export const links: LinksFunction = () => {
return [{ rel: "stylesheet", href: globalStylesheetUrl }];
};
@@ -26,7 +22,6 @@ const App = () => (
<meta name="viewport" content="width=device-width,initial-scale=1" />
<Meta />
<Links />
<style>{extractCss()}</style>
</head>
<body>
<Outlet />


+ 0
- 7
packages/kitchen-sink/react-remix/app/routes/_index.tsx Ver arquivo

@@ -2,13 +2,6 @@ import type { V2_MetaFunction } from "@remix-run/react";
import {Link} from '@remix-run/react';
import { Layouts } from '@tesseract-design/viewfinder-react';

// const Layouts = {
// Basic: {
// Root: 'div',
// ContentContainer: 'div',
// }
// }

export const meta: V2_MetaFunction = () => {
return [{ title: "New Remix App" }];
};


+ 6
- 8
packages/kitchen-sink/react-remix/app/routes/layouts.basic.tsx Ver arquivo

@@ -1,14 +1,12 @@
import ReactMarkdown from '~/components/ReactMarkdown';
import ReactMarkdown from 'app/components/ReactMarkdown';
import { Layouts, Widgets } from '@tesseract-design/viewfinder-react';
import {Span} from '@tesseract-design/viewfinder-base';
import {Brand} from '~/components/Brand';
import {Image} from '~/components/Image'
import {Brand} from 'app/components/Brand';
import {Image} from 'app/components/Image'
import {Link, useSearchParams} from '@remix-run/react';


const BasicLayoutPage = () => {
const params = useSearchParams();
const { span = Span.NORMAL } = Object.fromEntries(params.entries());
const { span = "normal" } = Object.fromEntries(params.entries());
return (
<Layouts.Basic.Root
topBarWidget={
@@ -16,7 +14,7 @@ const BasicLayoutPage = () => {
brand={
<Brand />
}
span={span as Span}
span={span}
userLink={
<Link
to="#"
@@ -28,7 +26,7 @@ const BasicLayoutPage = () => {
}
>
<Layouts.Basic.ContentContainer
span={span as Span}
span={span}
>
<ReactMarkdown
components={{


+ 198
- 66
packages/kitchen-sink/react-remix/app/routes/layouts.left-sidebar-with-menu.tsx Ver arquivo

@@ -1,78 +1,210 @@
import { Layouts, Widgets } from '@tesseract-design/viewfinder-react';
import {Span} from '@tesseract-design/viewfinder-base';
import {Brand} from '~/components/Brand';
import {DummyLinks} from '~/components/DummyLinks';
import {Brand} from 'app/components/Brand';
import ReactMarkdown from 'app/components/ReactMarkdown';
import {Image} from 'app/components/Image';
import {useSearchParams, Link} from '@remix-run/react';
import type {FC, ReactNode} from 'react';

type LinkComponentProps = {
url: string;
label: string;
icon: ReactNode;
}

const LinkComponent: FC<LinkComponentProps> = ({
url,
label,
icon,
}) => (
<Link
to={url}
>
<Layouts.LeftSidebarWithMenu.SidebarMenuContainer>
<Layouts.LeftSidebarWithMenu.SidebarMenuItemIcon>
{icon}
</Layouts.LeftSidebarWithMenu.SidebarMenuItemIcon>
{label}
</Layouts.LeftSidebarWithMenu.SidebarMenuContainer>
</Link>
)

const MoreLinkComponent: FC<LinkComponentProps> = ({
url,
label,
icon,
}) => (
<Link
to={url}
>
<Layouts.LeftSidebarWithMenu.MoreSidebarMenuContainer>
<Layouts.LeftSidebarWithMenu.MoreSidebarMenuItemIcon>
{icon}
</Layouts.LeftSidebarWithMenu.MoreSidebarMenuItemIcon>
{label}
</Layouts.LeftSidebarWithMenu.MoreSidebarMenuContainer>
</Link>
)

const menuLink = (
<Link
to="?open=sidebar"
>
Menu
</Link>
);

const userLink = (
<Link
to="?open=sidebar"
>
User
</Link>
);

const LeftSidebarWithMenuLayoutPage = () => {
const params = useSearchParams();
const { open } = Object.fromEntries(params.entries()) as unknown as Record<string, string>;
const sidebarOpen = open === 'sidebar';
const moreItemsOpen = open === 'more';

return (
<Layouts.LeftSidebarWithMenu.Root
sidebarBaseWidget={
<Widgets.LeftSidebarWithMenuBase
span={Span.WIDE}
open={sidebarOpen}
style={{
backgroundColor: 'inherit',
}}
items={[
{
id: '1',
label: 'Item 1',
icon: '1',
url: '#',
}
]}
linkComponent={({
url,
label,
icon,
}) => (
<a
href={url}
>
<Layouts.LeftSidebarWithMenu.SidebarContentContainer>
<Layouts.LeftSidebarWithMenu.SidebarContentContainer>
{icon}
</Layouts.LeftSidebarWithMenu.SidebarContentContainer>
{label}
</Layouts.LeftSidebarWithMenu.SidebarContentContainer>
</a>
)}
>
<Layouts.LeftSidebarWithMenu.SidebarContentContainer>
Sidebar
</Layouts.LeftSidebarWithMenu.SidebarContentContainer>
</Widgets.LeftSidebarWithMenuBase>
}
topBarWidget={
<Widgets.TopBar
brand={
<Brand />
}
style={{
backgroundColor: 'inherit',
}}
menuLink={
<Link
to="?open=sidebar"
>
Open
</Link>
}
span={Span.WIDE}
>
<DummyLinks />
</Widgets.TopBar>
}
>
<Layouts.LeftSidebarWithMenu.MainContentContainer>
Hello
</Layouts.LeftSidebarWithMenu.MainContentContainer>
</Layouts.LeftSidebarWithMenu.Root>
<Layouts.LeftSidebarWithMenu.Root
sidebarBaseWidget={
<Widgets.LeftSidebarWithMenuBase
span="wide"
open={sidebarOpen}
moreItemsOpen={moreItemsOpen}
items={[
{
id: 'foo',
icon: 'F',
label: 'Foo',
url: '#foo',
},
{
id: 'bar',
icon: 'B',
label: 'Bar',
url: '#bar',
},
{
id: 'baz',
icon: 'Z',
label: 'Baz',
url: '#baz',
},
{
id: 'quux',
icon: 'Q',
label: 'Quux',
url: '#quux',
},
{
id: 'quuux',
icon: 'U',
label: 'Quuux',
url: '#quuux',
secondary: true,
},
{
id: 'quuuux',
icon: 'X',
label: 'Quuuux',
url: '#quuuux',
secondary: true,
},
]}
linkComponent={LinkComponent}
moreLinkItem={{
url: {
query: {
open: 'more',
},
},
icon: 'M',
label: 'More',
}}
moreLinkComponent={MoreLinkComponent}
>
<a
href="#foo"
style={{
display: 'flex',
alignItems: 'center',
height: '3rem',
}}
>
<Layouts.LeftSidebarWithMenu.SidebarContentContainer>
Foo
</Layouts.LeftSidebarWithMenu.SidebarContentContainer>
</a>
<a
href="#bar"
style={{
display: 'flex',
alignItems: 'center',
height: '3rem',
}}
>
<Layouts.LeftSidebarWithMenu.SidebarContentContainer>
Bar
</Layouts.LeftSidebarWithMenu.SidebarContentContainer>
</a>
<a
href="#baz"
style={{
display: 'flex',
alignItems: 'center',
height: '3rem',
}}
>
<Layouts.LeftSidebarWithMenu.SidebarContentContainer>
Baz
</Layouts.LeftSidebarWithMenu.SidebarContentContainer>
</a>
</Widgets.LeftSidebarWithMenuBase>
}
topBarWidget={
<Widgets.TopBar
brand={
<Brand />
}
menuLink={menuLink}
userLink={userLink}
span="wide"
/>
}
>
<Layouts.LeftSidebarWithMenu.MainContentContainer>
<ReactMarkdown
components={{
img: Image,
}}
>
{`# Piano

![Bechstein Moor](/static/piano/bechstein-moor-grand-00.jpg)

The piano is an acoustic, stringed musical instrument invented in Italy by Bartolomeo Cristofori around the year 1700 (the exact year is uncertain), in which the strings are struck by wooden hammers that are coated with a softer material (modern hammers are covered with dense wool felt; some early pianos used leather). It is played using a keyboard, which is a row of keys (small levers) that the performer presses down or strikes with the fingers and thumbs of both hands to cause the hammers to strike the strings.

![Bechstein Moor](/static/piano/bechstein-moor-grand-01.jpg)

The word piano is a shortened form of pianoforte, the Italian term for the early 1700s versions of the instrument, which in turn derives from gravicembalo col piano e forte (key cymbal with quieter and louder) and fortepiano. The Italian musical terms piano and forte indicate "soft" and "loud" respectively, in this context referring to the variations in volume (i.e., loudness) produced in response to a pianist's touch or pressure on the keys: the greater the velocity of a key press, the greater the force of the hammer hitting the strings, and the louder the sound of the note produced and the stronger the attack. The name was created as a contrast to harpsichord, a musical instrument that does not allow variation in volume; compared to the harpsichord, the first fortepianos in the 1700s had a quieter sound and smaller dynamic range.

![Bösendorfer Moor](/static/piano/boesendorfer-moor-grand-00.jpg)

A piano usually has a protective wooden case surrounding the soundboard and metal strings, which are strung under great tension on a heavy metal frame. Pressing one or more keys on the piano's keyboard causes a wooden or plastic hammer (typically padded with firm felt) to strike the strings. The hammer rebounds from the strings, and the strings continue to vibrate at their resonant frequency. These vibrations are transmitted through a bridge to a soundboard that amplifies by more efficiently coupling the acoustic energy to the air. When the key is released, a damper stops the strings' vibration, ending the sound. Notes can be sustained, even when the keys are released by the fingers and thumbs, by the use of pedals at the base of the instrument. The sustain pedal enables pianists to play musical passages that would otherwise be impossible, such as sounding a 10-note chord in the lower register and then, while this chord is being continued with the sustain pedal, shifting both hands to the treble range to play a melody and arpeggios over the top of this sustained chord. Unlike the pipe organ and harpsichord, two major keyboard instruments widely used before the piano, the piano allows gradations of volume and tone according to how forcefully or softly a performer presses or strikes the keys.

![Bösendorfer Moor](/static/piano/boesendorfer-moor-grand-01.jpg)

Most modern pianos have a row of 88 black and white keys, 52 white keys for the notes of the C major scale (C, D, E, F, G, A and B) and 36 shorter black keys, which are raised above the white keys, and set further back on the keyboard. This means that the piano can play 88 different pitches (or "notes"), going from the deepest bass range to the highest treble. The black keys are for the "accidentals" (F♯/G♭, G♯/A♭, A♯/B♭, C♯/D♭, and D♯/E♭), which are needed to play in all twelve keys. More rarely, some pianos have additional keys (which require additional strings), an example of which is the Bösendorfer Concert Grand 290 Imperial, which has 97 keys. Most notes have three strings, except for the bass, which graduates from one to two. The strings are sounded when keys are pressed or struck, and silenced by dampers when the hands are lifted from the keyboard. Although an acoustic piano has strings, it is usually classified as a percussion instrument rather than as a stringed instrument, because the strings are struck rather than plucked (as with a harpsichord or spinet); in the Hornbostel–Sachs system of instrument classification, pianos are considered chordophones. There are two main types of piano: the grand piano and the upright piano. The grand piano has a better sound and gives the player a more precise control of the keys, and is therefore the preferred choice for every situation in which the available floor-space and the budget will allow, as well as often being considered a requirement in venues where skilled pianists will frequently give public performances. The upright piano, which necessarily involves some compromise in both tone and key action compared to a grand piano of equivalent quality, is nevertheless much more widely used, because it occupies less space (allowing it to fit comfortably in a room where a grand piano would be too large) and is significantly less expensive.

![Bösendorfer Moor](/static/piano/boesendorfer-moor-grand-02.jpg)

During the 1800s, influenced by the musical trends of the Romantic music era, innovations such as the cast iron frame (which allowed much greater string tensions) and aliquot stringing gave grand pianos a more powerful sound, with a longer sustain and richer tone. In the nineteenth century, a family's piano played the same role that a radio or phonograph played in the twentieth century; when a nineteenth-century family wanted to hear a newly published musical piece or symphony, they could hear it by having a family member play a simplified version on the piano. During the nineteenth century, music publishers produced many types of musical works (symphonies, opera overtures, waltzes, etc.) in arrangements for piano, so that music lovers could play and hear the popular pieces of the day in their home. The piano is widely employed in classical, jazz, traditional and popular music for solo and ensemble performances, accompaniment, and for composing, songwriting and rehearsals. Although the piano is very heavy and thus not portable and is expensive (in comparison with other widely used accompaniment instruments, such as the acoustic guitar), its musical versatility (i.e., its wide pitch range, ability to play chords, louder or softer notes and two or more independent musical lines at the same time), the large number of musicians - both amateurs and professionals - trained in playing it, and its wide availability in performance venues, schools and rehearsal spaces have made it one of the Western world's most familiar musical instruments.`}
</ReactMarkdown>
</Layouts.LeftSidebarWithMenu.MainContentContainer>
</Layouts.LeftSidebarWithMenu.Root>
)
}



+ 4
- 6
packages/kitchen-sink/react-remix/app/routes/layouts.left-sidebar.tsx Ver arquivo

@@ -1,8 +1,7 @@
import { Layouts, Widgets } from '@tesseract-design/viewfinder-react';
import {Span} from '@tesseract-design/viewfinder-base';
import {Brand} from '~/components/Brand';
import {Image} from '~/components/Image';
import ReactMarkdown from '~/components/ReactMarkdown';
import {Brand} from 'app/components/Brand';
import {Image} from 'app/components/Image';
import ReactMarkdown from 'app/components/ReactMarkdown';
import {Link, useSearchParams} from '@remix-run/react';

const LeftSidebarLayoutPage = () => {
@@ -14,7 +13,6 @@ const LeftSidebarLayoutPage = () => {
<Layouts.LeftSidebar.Root
sidebarBaseWidget={
<Widgets.LeftSidebarBase
span={Span.WIDE}
open={sidebarOpen}
>
<a
@@ -74,7 +72,7 @@ const LeftSidebarLayoutPage = () => {
User
</Link>
}
span={Span.WIDE}
span="wide"
/>
}
>


+ 5
- 8
packages/kitchen-sink/react-remix/app/routes/layouts.right-sidebar-static.tsx Ver arquivo

@@ -1,17 +1,14 @@
import { Layouts, Widgets } from '@tesseract-design/viewfinder-react';
import {Span} from '@tesseract-design/viewfinder-base';
import {Brand} from '~/components/Brand';
import {Image} from '~/components/Image';
import ReactMarkdown from '~/components/ReactMarkdown';
import {Brand} from 'app/components/Brand';
import {Image} from 'app/components/Image';
import ReactMarkdown from 'app/components/ReactMarkdown';
import {Link} from '@remix-run/react';

const RightSidebarStaticLayoutPage = () => {
return (
<Layouts.RightSidebarStatic.Root
sidebarBaseWidget={
<Widgets.RightSidebarStaticBase
span={Span.WIDE}
>
<Widgets.RightSidebarStaticBase>
<a
href="#foo"
style={{
@@ -62,7 +59,7 @@ const RightSidebarStaticLayoutPage = () => {
User
</Link>
}
span={Span.WIDE}
span="wide"
/>
}
>


+ 3
- 41
packages/kitchen-sink/react-remix/app/style.css Ver arquivo

@@ -1,41 +1,3 @@
:root {
--base-width: 360px;
--color-background: white;
}

html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
line-height: 1.75;
}

a {
color: inherit;
text-decoration: none;
}

* {
box-sizing: border-box;
}

@media (prefers-color-scheme: dark) {
:root {
--color-background: black;
}

html {
color-scheme: dark;
}
body {
color: white;
background-color: var(--color-background);
}
}

#__next {
display: contents;
background-color: inherit;
}
@tailwind base;
@tailwind components;
@tailwind utilities;

+ 2
- 1
packages/kitchen-sink/react-remix/package.json Ver arquivo

@@ -11,7 +11,8 @@
"@remix-run/node": "^1.15.0",
"@remix-run/react": "^1.15.0",
"@remix-run/serve": "^1.15.0",
"@tesseract-design/viewfinder-react": "link:../../react",
"@tesseract-design/viewfinder-base": "workspace:*",
"@tesseract-design/viewfinder-react": "workspace:*",
"goober": "^2.1.12",
"isbot": "^3.6.5",
"react": "^18.2.0",


+ 6
- 0
packages/kitchen-sink/react-remix/postcss.config.js Ver arquivo

@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

+ 1
- 0
packages/kitchen-sink/react-remix/remix.config.js Ver arquivo

@@ -10,5 +10,6 @@ module.exports = {
v2_meta: true,
v2_normalizeFormMethod: true,
v2_routeConvention: true,
unstable_tailwind: true,
},
};

+ 12
- 0
packages/kitchen-sink/react-remix/tailwind.config.js Ver arquivo

@@ -0,0 +1,12 @@
const { tailwind } = require('@tesseract-design/viewfinder-base');

/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./app/**/*.tsx',
'./node_modules/@tesseract-design/viewfinder-react/dist/**/*.js',
],
plugins: [
tailwind.plugin(),
],
}

+ 0
- 3
packages/kitchen-sink/react-remix/tsconfig.json Ver arquivo

@@ -12,9 +12,6 @@
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": {
"~/*": ["./app/*"]
},

// Remix takes care of building everything in `remix build`.
"noEmit": true


+ 0
- 7288
packages/kitchen-sink/react-remix/yarn.lock
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


+ 1
- 1
packages/react/src/layouts/Basic/index.tsx Ver arquivo

@@ -1,6 +1,6 @@
import * as React from 'react';
import clsx from 'clsx';
import { SpanValues as Span } from '@tesseract-design/viewfinder-base';
import { Span } from '@tesseract-design/viewfinder-base';

export interface RootProps extends React.HTMLProps<HTMLDivElement> {
topBarWidget?: React.ReactNode;


+ 1
- 1
packages/react/src/layouts/LeftSidebarWithMenu/index.tsx Ver arquivo

@@ -3,7 +3,7 @@ import * as React from 'react';
export interface RootProps extends React.HTMLProps<HTMLDivElement> {
sidebarBaseWidget?: React.ReactNode;
topBarWidget?: React.ReactNode;
};
}

export const Root = React.forwardRef<HTMLDivElement, RootProps>(({
children,


+ 1
- 1
packages/react/src/layouts/RightSidebarStatic/index.tsx Ver arquivo

@@ -3,7 +3,7 @@ import * as React from 'react';
export interface RootProps extends React.HTMLProps<HTMLDivElement> {
sidebarBaseWidget?: React.ReactNode;
topBarWidget?: React.ReactNode;
};
}

export const Root = React.forwardRef<HTMLDivElement, RootProps>(({
children,


+ 1
- 1
packages/react/src/widgets/LeftSidebarWithMenuBase/index.tsx Ver arquivo

@@ -1,7 +1,7 @@
// TODO figure out how to refactor left sidebar with menu widget

import * as React from 'react';
import {SpanValues as Span} from '@tesseract-design/viewfinder-base';
import {Span} from '@tesseract-design/viewfinder-base';
import clsx from 'clsx';

type BaseMenuItem = {


+ 1
- 1
packages/react/src/widgets/TopBar/index.tsx Ver arquivo

@@ -1,6 +1,6 @@
import * as React from 'react';
import clsx from 'clsx';
import { SpanValues as Span } from '@tesseract-design/viewfinder-base';
import { Span } from '@tesseract-design/viewfinder-base';

export interface TopBarProps extends Omit<React.HTMLProps<HTMLDivElement>, 'span'> {
span?: Span,


+ 0
- 4110
packages/react/yarn.lock
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


+ 258
- 478
pnpm-lock.yaml
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


Carregando…
Cancelar
Salvar