Coder Social home page Coder Social logo

afeiship / react-ellipsis-middle Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 494 KB

Ellipsis in middle for single line text.

License: MIT License

JavaScript 44.75% SCSS 6.36% HTML 4.00% TypeScript 44.90%
react component react-component ellipsis-middle ellipsis middle center line-clamp

react-ellipsis-middle's Introduction

react-ellipsis-middle

Ellipsis in middle for single line text.

version license size download

installation

npm install -S @jswork/react-ellipsis-middle

usage

  1. import css
@import "~@jswork/boilerplate-react-component/dist/style.css";

// or use sass
@import "~@jswork/boilerplate-react-component/dist/style.scss";

// customize your styles:
$boilerplate-react-component-options: ()
  1. import js
import React from 'react';
import ReactEllipsisMiddle from '@jswork/boilerplate-react-component';
import styled from 'styled-components';
import '../../src/components/style.scss';

const Container = styled.div`
  width: 600px;
  margin: 50px auto;
  border-radius: 8px;
  padding: 15px;
  overflow: hidden;
  resize: horizontal;
  box-shadow: 20px 20px 60px #bebebe, -20px -20px 60px #ffffff;

  .react-ellipsis-middle {
    cursor: pointer;
    &:hover {
      transition: all 0.5s ease;
      background-color: #f60;
    }
  }
`;

export default (props: any) => {
  return (
    <Container>
      <ReactEllipsisMiddle size="120px">
        CSS 测试标题,这是一个稍微有点长的标题,超出一行以后才会有title提示,标题是 实现优惠券的技巧
        - 2021-03-26
      </ReactEllipsisMiddle>

      <ReactEllipsisMiddle size="50%">
        CSS 测试标题,这是一个稍微有点长的标题,超出一行以后才会有title提示,标题是 实现优惠券的技巧
        - 2021-03-26
      </ReactEllipsisMiddle>

      <ReactEllipsisMiddle>CSS 实现优惠券的技巧 - 2021-03-26</ReactEllipsisMiddle>
      <ReactEllipsisMiddle minSize="40px">
        我是一个很长的文件,我是一个很长的文件,但请始终保持我的后缀名.pdf
      </ReactEllipsisMiddle>
    </Container>
  );
};

preview

license

Code released under the MIT license.

react-ellipsis-middle's People

Contributors

afeiship avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.