Skip to content

[WIP] Block proxy#5

Closed
d3dc wants to merge 2 commits intomasterfrom
block-proxy
Closed

[WIP] Block proxy#5
d3dc wants to merge 2 commits intomasterfrom
block-proxy

Conversation

@d3dc
Copy link
Owner

@d3dc d3dc commented Aug 5, 2018

A solution to #2. Enables the following style where Box is omitted.

I'm not sure I like it, as it gives the appearance of a lot of magic happening.

import { Component } from 'react'
import { Comp, createBlock } from 'classier-react'

import logo from './logo.svg'

const AppContainer = createBlock(require('./App.css'))

export default class App extends Component {
  render() {
    return (
      <AppContainer hover={{ bg: 'blue' }}>
        <AppContainer.Header border={['solid', 'black']} is="header">
          <Comp as={AppContainer.Logo}>
            <img src={logo} alt="logo" />
          </Comp>
          <AppContainer.Title is="h1">Welcome to React</AppContainer.Title>
        </AppContainer.Header>
        <AppContainer.Intro is="p">
          To get started, edit <code>src/App.js</code> and save to reload.
        </AppContainer.Intro>
      </AppContainer>
    )
  }
}

@d3dc d3dc force-pushed the master branch 2 times, most recently from 9f92a99 to 3b5928b Compare August 7, 2018 03:55
@d3dc
Copy link
Owner Author

d3dc commented Aug 10, 2018

I've inadvertently gone and passed an object to createBlock here.

This is the object the proxy for unknown classes sits on top of.

You don't need a proxy when there is an object. The proxy is for the case when there is a string namespace to add. Can this just return a specialized Box or something instead of a proxy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant