npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mjv-fabrica-gc/portal-mjv-components

v0.8.0

Published

Sharepoint ui lib for react presentational components

Downloads

18

Readme

Portal MJV components

The MJV's React Typescript front-end ui lib for building interfaces for sharepoint online.

Using the library

You can install this lib with npm i @mjv-fabrica-gc/portal-mjv-components. After it, just import and use the desired components:

import * as React from "react";
import { Component } from "@mjv-fabrica-gc/portal-mjv-components";

const WebPart: React.SFC<any> = () => {
  return (
    <>
      <h1>Demo</h1>
      <Component prop="example" />
    </>
  );
};

For components details, please check the development section.

Development

Node v10.19.0 is required in development to avoid incompatibilities with Sharepoint

Having that in mind, open a terminal of your choice, clone the project repository on your local machine and run npm install.

Available scripts:

  • storybook: Runs a local server for development and documentation purpose
  • build: Build the components exposed in src/index.ts in a publishable package

Creating a component

Let's assume that we want a new component called Demo that receives a title as prop and renders it.

At src/components/ create a new folder with the component name, in this case we will get an src/components/Demo directory.

Now, it's important to create our base files. Start with a ComponentName.tsx and an index.ts. Styles are also important so create a ComponentName.modules.scss file, don't forget the .modules as this lib implements the css modules by default.

In our Demo, we will get something like this:

index.ts

export { default } from "./Demo";

Demo.modules.scss

// It's a good practice wrap all your css at a root class, avoid use id's
.demo {
  .title {
    font-size: 36px;
  }
}

Demo.tsx

import * as React from "react";
import s from "./Demo.modules.scss";
/*
  Your text editor will probably blow up with the scss modules import. Don't worry about it, run or build our package will automatically generate a .module.scss.d.ts file that exports our styles
  definitions
*/

// First, let's define the types of our component's props
interface IDemoProps {
  title: string;
}

/*
  And the core of our component goes here, css modules also allow us to implement our classNames
  in a wonderful way
*/
const Demo: React.SFC<IDemoProps> = ({ title }) => {
  return (
    <div className={s.demo}>
      <h1 className={s.title}>{title}</h1>
    </div>
  );
};

export default Demo;

Finished with your component development, export it on src/index.ts:

import Example from "./components/Example";
import Demo from "./components/Demo";

export { Example, Demo };

Testing

Now, to run the development local server, run npm run storybook. It should open a page on your browser. Changes on your code will auto-refresh your development.

Publishing

Important! Do not deploy the lib without proper authorization

To publish a new release to npm registry we will first need a npm account with access to @mjv-fabrica-gc organization.

Make sure that all components are properly exported from src/index.ts and upgrade the version key in package.json. For example, if you want to publish a fix release you will change "version": "0.0.0" to "version": "0.0.1".

After these steps, everything is OK to publish the package. Then run npm run build and right after it run npm publish --access=public. You will get an affirmative message if everything is right.

License

All files in this GitHub repository are subject to the MIT license