Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lll-components

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lll-components

WAE Component Library

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

WAE Component Library

This is a poc to:

  1. Using Component Library
  2. Render static markup per-component

Using Component Library

have a component library for all web UI components.

  1. Install yarn install wae-components@1.0.0 or from the repos url yarn install https://github.com/Lululemon/wae-components

  2. Use it in your project!

// import it
import Page from 'wae-components/components/Page';
import Header from 'wae-components/components/Header';
// use it
const HomePage = () => (
  <Page>
    <Header 
      title="my title"
    />
  </Page>
);

Render static markup per-component

This renders static markup *per-*component

  1. Genrate Static HTML Markup:
yarn export

this runs

"export": "node generate-static-markup.js"

and outputs html fragments based off of the partials to the markup directory.

Example.*

Input src/component/Header.js:

import React from "react";

export default class Header extends React.Component {
  render(){
    return <div>Hello Header</div>;
  }
}

Output markup/Header.html:

<div>Hello Header</div>

This can be use in many ways like some of the following.

Use case 1:

import React from "react";
import ReactDOM from "react-dom";


// these props will be the default props used with ssr and the static markup
const headerProps = {
  title: "my title"
}
ReactDOM.render(<Page />, document.getElementById("page"));
ReactDOM.render(<Header {...headerProps}/>, document.getElementById("header"));

index.html should have:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Example App</title>
</head>
<body>
  <section id="header"></section>
  <section id="page"></section>
</body>
</html>

Use case 2:

const renderTemplate = ({
  title,
  Partials
  }) => `
  <!DOCTYPE html>
  <html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>${title}</title>
  </head>
  <body>
    ${Partials.Header}
    ${Partials.Page}
  </body>
  </html>
)`
import renderTemplate from './renderTemplate'
app.use('*', (req,res)=>{
 const myTemplate = renderTemplate({
    title: "my title",
    Partials
  })
  res.send(myTemplate)
})

FAQs

Package last updated on 14 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc