0.1.0 • Published 5 years ago

jump-ventures-components v0.1.0

Weekly downloads
-
License
-
Repository
-
Last release
5 years ago

This project was bootstrapped with Create React App.

jump-ventures-components

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode. Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits. You will also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode. See the section about running tests for more information.

npm run build

Builds the app for production to the build folder. It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes. Your app is ready to be deployed!

See the section about deployment for more information.

npm run eject

Note: this is a one-way operation. Once you eject, you can’t go back!

If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

Learn More

You can learn more in the Create React App documentation.

To learn React, check out the React documentation.

Register pages

Inside index.tsx you'll be able to register new routes and their belonging pages. Simply add your page to the following part, for example the About page:

import * as About from './pages/About';

<Switch>
    <Route exact path="/">
        <Home/>
    </Route>
    <Route path="/about">
        <About/>
    </Route>
</Switch>

Inside those pages you can use the predefined components. Firstly you'll need to create a page component:

// pages/about
import React from 'react';

const About: React.FC = () => {
    return (
        <div className="page">
            <h1>My about page</h1>
        </div>
    );
};

export default About;

Now you'll be able to use the components inside your page template.

Components

All components have the same default props:

PropsTypeBehaviour
classNamestringadds classnames to the main component
fluidbooleandefault false, adds container-fluid instead of container when true
spacingstringbootstrap utility class (py-5) to add padding or margin

TextImageBlock

Component with left an image and to the right HTML, like h1 h2 and paragraphs.

PropsTypeBehaviour
childrenReactNode
imageUrlstringused for the image
textColSizesColSizessee ColSizes

Example:

const Page = () => {
   return (
       <div>
           <TextImageBlock imageUrl="https://google.nl/2314" spacing="my-5" textColSizes={{
                   md: 4,
                   lg: 8
               }}>
               <h1>Test heading</h1>
               <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Beatae dolores esse excepturi illo ipsa
                   iste itaque non possimus quaerat rem, repudiandae tenetur vel. At error nobis non praesentium quos
                   voluptates!</p>
           </TextImageBlock>
       </div>
   );
};

Buttons

Buttons component, which you could place after any block for their CTA.

PropsTypeBehaviour
buttonsButtonInterface { color: colorstring, text: string}color like the bootstrap colors (primary, secondary, danger, success) text for inside the button
alignleft, center, right stringdefault left, positions the buttons

Example:

const buttons = [{
    text: 'test 1',
    color: 'success'
}, {
    text: 'test 2',
    color: 'danger'
}];

const Page = () => {
   return (
       <div>
           <Buttons buttons={buttons} align="center" spacing="my-5"/>
       </div>
   );
};

ImageGrid

PropsTypeBehaviour
imagesImageGridItem[]
colSizesColSizessee ColSizes

ImageGridItem

PropsTypeBehaviour
urlstringimage url
altTextstringalt text attribute
titlestring (optional)title for beneath the image

Example:

const getRandomImage = (width: number, height: number) => {
    return `https://picsum.photos/id/${Math.floor(Math.random() * 100)}/${width}/${height}`;
};

const images: ImageGridItem[] = [{
    title: 'Afbeelding met titel',
    url: getRandomImage(400, 300),
    altText: 'test 1',
}, {
    title: 'Afbeelding met titel',
    url: getRandomImage(400, 300),
    altText: 'test 1',
}, {
    title: 'Afbeelding met titel',
    url: getRandomImage(400, 300),
    altText: 'test 1',
}];

const Page = () => {
    return (
        <div>
            <ImageGrid images={images} colSizes={{
                md: 4,
                xs: true
            }}/>
        </div>

    );
};