0.10.0 • Published 1 year ago

romaine-components v0.10.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

romaine-components

Component library for use with romaine

Installation

$ npm i romaine-components OR $ yarn add romaine-components romaine

Example

import { useEffect, useState, useMemo } from "react";
import { RomaineExample } from "romaine-components/example";
import { Romaine } from "romaine";

function App() {
  const [blob, setBlob] = useState<Blob | null>(null);
  const image = useMemo(
    () => `https://source.unsplash.com/random?unique=${Math.random()}`,
    []
  );
  useEffect(() => {
    if (blob !== null) {
      const url = window.URL.createObjectURL(blob);
      const link = document.createElement("a");
      link.href = url;
      link.setAttribute("download", "image.png"); //or any other extension
      document.body.appendChild(link);
      link.click();
    }
  }, [blob]);

  return (
    <div className="App">
      <Romaine angle={90}>
        <RomaineExample
          imageExportOptions={{ type: "image/jpeg", quality: 0.92 }}
          setBlob={setBlob}
          image={image}
        />
      </Romaine>
    </div>
  );
}

export default App;

Field Inputs

Romaine

Note:

Changing props triggers the Context Alternative, which causes an un-needed render when you can use the context alternative yourself.

ParameterTypeDescriptionDefaultContext Alternative
anglenumberTurn angle for rotation tool90setAngle(90)

Romaine Components

ParameterTypeDescriptionDefault
imageExportOptionsobjectObject given to RomaineRef.current?.getBlob() function90
setBlobfunctionsetter function give from useState hookundefined
imagestringlocation (URL or File) of the imagenull

imageExportOptions

ParameterTypeDescriptionDefault
type: "image/jpeg"stringObject given to RomaineRef.current?.getBlob() functionimage/png
qualitynumberQuality settings for image when type = image/webp OR image/jpeg0.92
0.10.0

1 year ago

0.8.0

2 years ago

0.7.1

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.2

3 years ago

0.0.0

3 years ago