Git Product home page Git Product logo

components's Introduction

commitd

Committed commitd

components's People

Contributors

chrisflatley avatar dependabot[bot] avatar jonnyelliot avatar kristian-committed avatar stuarthendren avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

coreybruyere

components's Issues

Button should forward the ref to the material component

Example issue from a storybook

Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()? 

Check the render method of `Styled(Component)`. 
    at http://localhost:6006/vendors~main.ab3ba32b17a7f0de2017.bundle.js:1290:16
    at Styled(Component) (http://localhost:6006/vendors~main.ab3ba32b17a7f0de2017.bundle.js:58034:28)
    at div
    at ThemeProvider (http://localhost:6006/vendors~main.ab3ba32b17a7f0de2017.bundle.js:56966:24)
    at ControlledThemeProvider (http://localhost:6006/vendors~main.ab3ba32b17a7f0de2017.bundle.js:3339:20)
    at ThemeController (http://localhost:6006/vendors~main.ab3ba32b17a7f0de2017.bundle.js:3295:71)
    at CustomThemeProvider
    at ThemeProvider
    at storyFn
    at ErrorBoundary 

Menu Component

Based on Radix Dropdown Menu

Trigger should use Slot like our Dialog.
Menu parts should be exposed as MenuXxxx
Parts with subparts may be simplified i.e. the MenuCheckboxItem and MenuRadioItem should be constructed to use our own <Check />Icon. (As shown in Custom APIs)

Storybook should give examples covering all sub components.

Versions and npm support

React & React Dom should be allow | 17.0.0. types for react and react-dom are not 17.0.0. THis will align with material ui (currently template wants 17, but this components doesnt).

React script is now 4.0.1, but looks like 4.0.2 will be support TS 4.1 (then we can bump both to the latest versions).

Tthis is through npm install on template, it won't let me complete at the moment though next issues with be storybook etc).

Spacing prop returns undefined for values >7

As I understand the spacing is now exponential theres no need to go beyond 7 (as its very large).

But it would be very helpful to throw an error/warning if an incorrect value (say when copying a material-ui example that uses a large value). Currently spacing=8 simply returns undefined.

<Link /> light-mode text is inconsistent

4.2.0

import { Typography } from "@committed/components"
import { Header,  Root } from "@committed/layout"
...

return <Root> <Header> <Typography>{name}</Typography> </Header> </Root>

image
image

Swapping Typography for Link:

import { Link } from "@committed/components"
import { Header,  Root } from "@committed/layout"
...
return <Root> <Header> <Link>{name}</Link> </Header> </Root>

image
image

ThemeSwitch has the wrong colour in light mode too when in the header:

image

Beta Component tracker

Current components

Component covered by Radix
Component covered by Radix (Coming Soon)
Component Candidate for retirement

  • Accordion
  • Alert
  • Autocomplete
  • AppBar
  • Avatar
  • Backdrop
  • Badge
  • Box
  • Button
  • Caption
  • Card
  • Checkbox
  • Checktoken
  • Chip
  • CodeStyle
  • Container
  • Dialog
  • Divider (Separator)
  • Display
  • Drawer
  • Flex
  • Form
  • FormControl
  • Grid
  • Heading
  • #233
  • IconButton
  • Link
  • List
  • Loader Spinner
  • Logo
  • Menu
  • Monospace
  • Pagination
  • #157
  • Progress
  • Radio
  • Skeleton
  • Slider
  • Stepper
  • Switch
  • Tab
  • Table
  • Text
  • TextField
  • Theme Provider
  • Theme Switch
  • Timeline
  • ToggleButton
  • Toolbar
  • Tooltip
  • Typography

Additional components to consider

Remove @material-ui/styles peer dependency

As its pulled in by @material-ui/core.

Having styles as a peer prompts the user to install it separately. Doing so causes multiple styles versions to linger which breaks the theme provider.

Component for Link

In material-ui link the component prop allows for composition which is necessary for say react-router-dom.

https://material-ui.com/guides/composition/#link

This gets lost through here.

I'd added it back by declaring it:

import React from 'react'
import {
  Link as RouterLink,
  LinkProps as RouterLinkProps
} from 'react-router-dom'
import { Link as ComponentsLink } from '@committed/components'

/**
 * The underlying Material UI allows the component used to render the Link to be changed.
 * This is function is not publicised by @committed/components Link.
 * We add that property (component) back and then declare our new Link takes the
 * options from RouterLink too (which is does, these are passed to the component).
 */
const LinkWithComponent = ComponentsLink as React.FC<
  RouterLinkProps & {
    component: React.ElementType
  }
>

interface Props extends RouterLinkProps {
  children: React.ReactNode
}

export const Link: React.FC<Props> = props => {
  // If an external link?
  if (typeof props.to === 'string' && props.to.startsWith('http')) {
    return (
      <ComponentsLink href={props.to} target="_blank">
        {props.children}
      </ComponentsLink>
    )
  }

  // Else use a internal link, rendered using RouterLink
  return (
    <LinkWithComponent component={RouterLink} {...props}>
      {props.children}
    </LinkWithComponent>
  )
}

Simplify the use of ThemeProvider

The props are complex and difficult to use.
The complexity should be extracted to a separate function and exported separately to the ThemeProvider, The provider should just take full themes.

The api should allow simpler overriding of elements of the theme without having to supply everything. There should be options to override in both themes and separately in the light and the dark.

Ideas

const {light, dark} = createCommittedThemes() // default committed setup
const {light, dark} = createMaterialThemes() // a way to return to near material defaults

// To simply override a single element of both themes use a `common` key - rest deep merged
const const {light, dark} = createCommittedThemes({ common: {fonts: { fontSize: 20 }}})

// To override using default styles
const const {light, dark} = createCommittedThemes({ common: {fonts: (fontDefaults) => ({ ...fontDefaults:  typography: fontDefaults.text }}})

// For different light/dark config use `light` and `dark` keys
const const {light, dark} = createCommittedThemes({light: {}, dark: {}})

e.g. Typing

export interface ThemeConfig
  fonts?: FontOptions | (fonts: FontOptions) => FontOptions
  palette?: PaletteOptions | (palette: PaletteOptions) => PaletteOptions
  createShape?: ShapeOptions | (shape: ShapeOptions) => ShapeOptions
  createSpacing?: SpacingOptions | (spacing: SpacingOptions) => SpacingOptions
  createTypography?: TypographyOptions | (typography: TypographyOptions, palette: Palette)) => TypographyOptions
  overrides?: Overrides | (overrides: Overrides, palette: Palette) => Overrides
}

export interface ThemesConfig {
  common?: ThemeConfig
  light?: ThemeConfig
  dark?: ThemeConfig
}

Design tokens

Create the design tokens from the Figma file in stitches.

Yarn2 warning

On build:

Module not found: @committed/components tried to access @material-ui/styles, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

This appears to be correct in that @material-ui/styles in not a peer dependency but is imported (e.g. in src/styles/index.ts).

[Could be more of these but that I only see this first one].

Add husky back when fixed

Husky currently has a issue with npm 7
Add back in when fixed

"husky": {
    "hooks": {
      "pre-commit": "pretty-quick --staged --pattern '**/*.*(ts|tsx|json|md)'; tsdx lint",
      "pre-push": "npm test && npm run build && npm danger:local"
    }
  },

<Divider /> overload error

When using <Divider /> I get the error:

No overload matches this call.
  Overload 1 of 2, '(props: (Pick<DividerProps, "ref" | "style" | "title" | "children" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | ... 249 more ... | "light"> & StyledComponentProps<...> & { ...; } & Pick<...> & { ...; }) | (Pick<...> & ... 3 more ... & { ...; }), context?: any): ReactElement<...> | ... 1 more ... | null', gave the following error.
    Type '{}' is not assignable to type '(IntrinsicAttributes & Pick<DividerProps, "ref" | "style" | "title" | "children" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | ... 250 more ... | "light"> & StyledComponentProps<...> & { ...; } & Pick<...> & { ...; }) | (IntrinsicAttributes & ... 4 more ... & {...'.
      Property 'color' is missing in type '{}' but required in type 'Pick<PropsWithChildren<DividerProps>, "ref" | "style" | "title" | "children" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | ... 250 more ... | "light">'.
  Overload 2 of 2, '(props: PropsWithChildren<(Pick<DividerProps, "ref" | "style" | "title" | "children" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | ... 249 more ... | "light"> & StyledComponentProps<...> & { ...; } & Pick<...> & { ...; }) | (Pick<...> & ... 3 more ... & { ...; })>, context?: any): ReactElement<...> | ... 1 more ... | null', gave the following error.
    Type '{}' is not assignable to type '(IntrinsicAttributes & Pick<DividerProps, "ref" | "style" | "title" | "children" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | ... 250 more ... | "light"> & ... 4 more ... & { ...; }) | (IntrinsicAttributes & ... 5 more ... & { ...; })'.
      Property 'color' is missing in type '{}' but required in type 'Pick<PropsWithChildren<DividerProps>, "ref" | "style" | "title" | "children" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | ... 250 more ... | "light">'.ts(2769)

May be similar to #17

Port components from prior projects

  • UI JsonForm support
  • DescribedSelector
  • PageHeading / ButtonBar
  • TextIconButton
  • EmptyState
  • ConfirmDialog
  • Wizard

Our paginaton is zero indexed. I think this should be the norm (ie PaginationControl)

Error with SliderProps

onChange gets exported with incorrect typing.
Seems to be omitted, but the one from Span still appears and clashes with the correct Slider type.

Error in SliderProps

onChange gets exported with incorrect typing.
Seems to be omitted, but the one from Span still appears and clashes with the correct Slider type.

Add CodeStyle component

Add a system for adding our code styling to other sites.

Make the css directly dependent on the theme and expose via a components that
either makes the css available in nested components (or globally).

Beta branch set-up

To start the development of the beta we'll look to set up a clean branch with minimal carried over from the main.
The plan will be to move supporting elements, such as the test/storybook over on a component by component basis.

Add positioning properties to AppBar

Should support
'sticky' - stays in the same place on the page - things scroll under it - ideally would push content down
'normal' - just positions in normal block flow so stays in natural position when scrolled.

<Avatar /> missing prop error

Using the Avatar component in the form:

<Avatar m={1} alt="John Smith" src={"https://images-na.ssl-images-amazon.com/images/I/811Ij8XEr4L._SL1500_.jpg"} /> (as per one of the stories)

gives a compilation error:

Property 'childrenClassName' is missing in type '{ m: number; alt: string; src: string; }' but required in type 'Pick<PropsWithChildren<AvatarProps>, "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | ... 285 more ... | "srcSet">'.ts(2769)

useStyles props parameter is not optional

Using 3.0.0

const useStyles = makeStyles({
  content: { flex: 1 },
})

...
// error - requires props parameters
useStyles()

I have to use useStyles({}) as a workaround.

Add Theme provider

Will be important to check designs in light and dark mode so makes sense to add this early.

Define typography standard

What fonts to use.
Do we have separate Display, Text, Typography, Heading, Monospace component or a single component with variants?

Loader has on-off prop for animation

Would be nice to be able to have the loader in top left of menu and then 'spin' when we are downloading data

eg with react-query

const isFetching = useIsFetching()

return (
<Loader loading={isFetching > 0) /> 
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.