Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
cb662af
Add cornerActions to Sidebar. Create stories for all 3 variants.
Jun 2, 2022
4386391
Simplify stories.
Jun 3, 2022
e019f3c
Adjust nav menu invoker label.
Jun 3, 2022
56c21b0
Add change
Jun 3, 2022
6b4e24c
Fix Sidebar menu item Button padding.
Jun 3, 2022
e788164
Include build script from old prototype.
Jun 7, 2022
b682b78
Fix icon sizes. Set title to button text that may become truncated.
Jun 8, 2022
e47a684
Add changes.
Jun 8, 2022
b766444
Remove unused import.
Jun 8, 2022
adee176
Add another menu variant for the Sidebar 3+ corner actions case.
Jun 8, 2022
a1d9435
Fix sidebar invoker icon and corner actions height.
Jun 8, 2022
9bbf4a2
Export ViewContent which does what it says on the tin.
Jun 10, 2022
c058337
Update lockfile.
Jun 10, 2022
2424c61
Fix ViewContent types
Jun 10, 2022
98ffe01
Use alea package for reproduceable IDs.
Jun 10, 2022
9a43d12
No more Math.random()
Jun 10, 2022
2c80144
Add flat prop variant to Sidebar.
Jun 10, 2022
61a9b32
Add sample app.
Jun 10, 2022
8d7b64f
Fix lint staged
Jun 10, 2022
f0ab7fd
Use TabList instead of buttons in Sidebar.
Jun 11, 2022
b7f5ee8
Use TabList instead of buttons in Sidebar.
Jun 11, 2022
dc9aab2
Merge branch 'feat/sidebar-nav' into feat/sample-app
Jun 11, 2022
84d1c64
Merge remote-tracking branch 'origin/next' into feat/sidebar-nav
Jun 17, 2022
06cea2a
Update lockfile.
Jun 17, 2022
c425872
Mange Sidebar tab item state and respond to interactions.
Jun 17, 2022
570b73e
Merge branch 'feat/sidebar-nav' into feat/sample-app
Jun 17, 2022
9bfe2de
Update deps & lockfile.
Jun 17, 2022
5e6b23f
Fix View props.
Jun 17, 2022
25e5c73
Merge branch 'feat/sidebar-nav' into feat/sample-app
Jun 17, 2022
2e71907
Fix Sidebar tab item implementation and View props.
Jun 17, 2022
d80ce2b
Merge branch 'feat/sidebar-nav' into feat/sample-app
Jun 17, 2022
c185ad4
Start building model for L1 navigation and pages.
Jun 17, 2022
39fae06
Sidebar updates state if its defaultActiveItem prop changes.
Jun 18, 2022
246957f
Merge branch 'feat/sidebar-nav' into feat/sample-app
Jun 18, 2022
f7bfe23
Set up Apps page.
Jun 21, 2022
f5b4255
Fix faker dep.
Jun 21, 2022
ebe216d
Fix missing background in outline variation of Button.
Jun 21, 2022
fabedcf
Cast zero to boolean so it isn’t rendered accidentally.
Jun 21, 2022
6e3ce76
Merge branch 'feat/sidebar-nav' into feat/sample-app
Jun 21, 2022
0340496
Update lockfile.
Jun 21, 2022
d91c03e
Set up App pages.
Jun 21, 2022
bb7b838
Flesh-out app pages
Jun 21, 2022
5b47c8b
Fix missing SSRProvider.
Jun 21, 2022
fce437e
Fix SSR hydration mismatch by removing whitespace.
Jun 21, 2022
85c3caa
Merge branch 'feat/sidebar-nav' into feat/sample-app
Jun 21, 2022
c2b51ce
Fix date weirdness.
Jun 21, 2022
6e24c1e
Merge remote-tracking branch 'origin/next' into feat/sample-app
Jun 21, 2022
d5cbd9f
Update lockfile
Jun 21, 2022
4c9cff0
Include fragments in code quality.
Jun 21, 2022
e17ed9c
Fix assets.
Jun 21, 2022
80d4775
Merge remote-tracking branch 'origin/next' into feat/sample-app
Jun 21, 2022
cc0c39e
Bump deps and update lockfile.
Jun 21, 2022
ee8e7ee
Merge branch 'next' into feat/sample-app
Jul 7, 2022
04e377f
Get up-to-date.
Jul 7, 2022
b5eba56
Fix build.
Jul 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"packages/*/{src,scripts,types,.storybook}/**/*.{js,jsx,ts,tsx,md,mdx,json}": "prettier --write",
"packages/*/{src,scripts,types,.storybook}/**/*.{js,jsx,ts,tsx}": "eslint --cache --max-warnings 0 --fix"
"packages/*/{src,scripts,types,pages,fragments,.storybook}/**/*.{js,jsx,ts,tsx,md,mdx,json}": "prettier --write",
"packages/*/{src,scripts,types,pages,fragments,.storybook}/**/*.{js,jsx,ts,tsx}": "eslint --cache --max-warnings 0 --fix"
}
38 changes: 38 additions & 0 deletions packages/react-sample-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo

# icons
public/basic-icons.svg
34 changes: 34 additions & 0 deletions packages/react-sample-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.

[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.

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.

## Learn More

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

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
3 changes: 3 additions & 0 deletions packages/react-sample-app/fragments/props.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Router } from 'next/router'

export interface FragmentProps extends Pick<Router, 'pathname' | 'query'> {}
201 changes: 201 additions & 0 deletions packages/react-sample-app/fragments/sidebar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
import isNull from 'lodash/isNull'
import UrlPattern from 'url-pattern'

import { SidebarProps } from '@fluent-blocks/react'

import { FragmentProps } from './props'

const appsPattern = new UrlPattern('/apps/[appid](/:appconfig)')

// eslint-disable-next-line max-lines-per-function
export default function sidebarFragment({
pathname,
query,
}: FragmentProps): SidebarProps {
const appsPatternMatch = appsPattern.match(pathname)
switch (true) {
case !isNull(appsPatternMatch):
return {
cornerActions: [
{ actionId: 'nav:/', label: 'Home', icon: 'home' },
{ actionId: 'nav:/apps', label: 'Apps', icon: 'apps' },
],
title: 'App name',
defaultActiveItem: `nav:/apps/${query.appid}${
appsPatternMatch.appconfig ? `/${appsPatternMatch.appconfig}` : ''
}`,
defaultOpenItems: ['app:overview', 'app:configure', 'app:publish'],
accordion: [
{
label: 'Overview',
actionId: 'app:overview',
menu: [
{
action: {
label: 'Dashboard',
actionId: `nav:/apps/${query.appid}`,
},
},
{
action: {
label: 'Analytics',
actionId: `nav:/apps/${query.appid}/analytics`,
},
},
],
},
{
label: 'Configure',
actionId: 'app:configure',
menu: [
{
action: {
label: 'Basic information',
actionId: `nav:/apps/${query.appid}/basic-info`,
},
},
{
action: {
label: 'Branding',
actionId: `nav:/apps/${query.appid}/branding`,
},
},
{
action: {
label: 'App features',
actionId: `nav:/apps/${query.appid}/app-features`,
},
},
{
action: {
label: 'Permissions',
actionId: `nav:/apps/${query.appid}/permissions`,
},
},
{
action: {
label: 'Single sign-on',
actionId: `nav:/apps/${query.appid}/sso`,
},
},
{
action: {
label: 'Languages',
actionId: `nav:/apps/${query.appid}/languages`,
},
},
{
action: {
label: 'Domains',
actionId: `nav:/apps/${query.appid}/domains`,
},
},
],
},
{
label: 'Advanced',
actionId: 'app:advanced',
menu: [
{
action: {
label: 'Owners',
actionId: `nav:/apps/${query.appid}/owners`,
},
},
{
action: {
label: 'App content',
actionId: `nav:/apps/${query.appid}/app-content`,
},
},
{
action: {
label: 'Environments',
actionId: `nav:/apps/${query.appid}/environments`,
},
},
{
action: {
label: 'Plans and pricing',
actionId: `nav:/apps/${query.appid}/plans-and-pricing`,
},
},
{
action: {
label: 'Admin settings',
actionId: `nav:/apps/${query.appid}/admin-settings`,
},
},
{
action: {
label: 'First party settings',
actionId: `nav:/apps/${query.appid}/first-party-settings`,
},
},
],
},
{
label: 'Publish',
actionId: 'app:publish',
menu: [
{
action: {
label: 'App package',
actionId: `nav:/apps/${query.appid}/app-package`,
},
},
{
action: {
label: 'Flights',
actionId: `nav:/apps/${query.appid}/flights`,
},
},
{
action: {
label: 'Publish to org',
actionId: `nav:/apps/${query.appid}/publish-to-org`,
},
},
{
action: {
label: 'Publish to store',
actionId: `nav:/apps/${query.appid}/publish-to-store`,
},
},
],
},
],
}
default:
return {
title: 'Dev portal',
defaultActiveItem: `nav:${pathname}`,
menu: [
{
action: {
actionId: 'nav:/',
icon: 'home',
label: 'Home',
variant: 'subtle' as 'subtle',
},
},
{
action: {
actionId: 'nav:/apps',
icon: 'apps',
label: 'Apps',
variant: 'subtle' as 'subtle',
},
},
{
action: {
actionId: 'nav:/tools',
icon: 'wrench',
label: 'Tools',
variant: 'subtle' as 'subtle',
},
},
],
}
}
}
33 changes: 33 additions & 0 deletions packages/react-sample-app/fragments/topbar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { TopbarProps } from '@fluent-blocks/react'

import { FragmentProps } from './props'

export default function topbar({
pathname,
}: FragmentProps): TopbarProps | undefined {
switch (pathname) {
case '/apps':
return {
near: {
menu: [
{
action: {
actionId: 'app:create',
label: 'New app',
icon: 'add',
},
},
{
action: {
actionId: 'app:import',
label: 'Import app',
icon: 'arrow_upload',
},
},
],
},
}
default:
return undefined
}
}
5 changes: 5 additions & 0 deletions packages/react-sample-app/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
13 changes: 13 additions & 0 deletions packages/react-sample-app/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const {join} = require('path')

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
config.resolve.alias['@fluent-blocks/react'] = join(__dirname, '../react/esm')
config.resolve.alias['@fluent-blocks/colors'] = join(__dirname, '../colors/esm')
return config
},
}

module.exports = nextConfig
30 changes: 30 additions & 0 deletions packages/react-sample-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "@fluent-blocks/react-sample-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"postinstall": "cp ../icons/basic-icons.svg public/basic-icons.svg; exit 0"
},
"dependencies": {
"@faker-js/faker": "^7.3.0",
"@fluent-blocks/basic-icons": "workspace:9.1.3-next.1",
"@fluent-blocks/react": "workspace:9.2.0-next.8",
"@fluentui/react-components": "^9.0.1",
"lodash": "^4.17.21",
"next": "^12.1.6",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"url-pattern": "^1.0.3"
},
"devDependencies": {
"@types/lodash": "latest",
"@types/node": "latest",
"@types/react": "18.x",
"@types/react-dom": "18.x",
"typescript": ">=4.4.0 <5.0.0"
}
}
Loading