1.0.0 • Published 12 months ago

react-telescopic-text v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

telescopic-text

React component for an implementation of telescopic text

NPM JavaScript Style Guide

Telescopic Text is a lightweight react component, which draws inspiration from this site, as a method to investigate playing with words in a sentence structure. This project was built in conjunction with a few other projects as a series of tools for making a more poetic web.

Install

npm install --save telescopic-text

or

yarn add telescopic-text

Usage

You need to import both the css file and package like so:

import React, { Component } from 'react'

import { TelescopicText } from 'telescopic-text'
import 'telescopic-text/dist/index.css'

class Example extends Component {
  render() {
    return <p>>Here is some <TelescopicText className="heading" fadeInSpeed={2000} color="aquamarine">text.<TelescopicText>more words that should be embellished on.</TelescopicText></TelescopicText></p>
  }
}

From here, the <TelescopicText> component can be nested infinitely many times, to create the corresponding branching tree.

Arguments

TelescopicText has three main props:

ArgumentTypeDefaultDescriptionExample
colorstringaquaA string to change the color of the highlight used for the textblack
classNameobject or stringnoneA style object or string (depending on what you're using)heading
fadeInSpeednumber2000A number (in ms) that corresponds to the fade in speed of the nested text that appears after clicking on an element4000

Future Work

Some kind of tree visualization / drag and drop as a way of interacting in a debugging manner. I think given the visual nature of this, it would benefit from having this.

License

MIT © zhaovan

1.0.0

12 months ago