react-alert-template-basic icon indicating copy to clipboard operation
react-alert-template-basic copied to clipboard

Overwrite the width

Open dmikester1 opened this issue 3 years ago • 1 comments

I am using this basic template for the react-alert library. It works well except my text is just slightly too long and wraps to the second line and doesn't look ideal. I'm wondering if there is a simple way to overwrite the width from this template?

const alertStyle = {
  backgroundColor: '#151515',
  color: 'white',
  padding: '10px',
  textTransform: 'uppercase',
  borderRadius: '3px',
  display: 'flex',
  justifyContent: 'space-between',
  alignItems: 'center',
  boxShadow: '0px 2px 2px 2px rgba(0, 0, 0, 0.03)',
  fontFamily: 'Arial',
  width: '300px',
  boxSizing: 'border-box'
}

dmikester1 avatar May 03 '21 03:05 dmikester1

The Template returns a React component with style as property. So you can do the following in your App Container:

function App () {

  return (
    <AlertProvider template={p => <AlertTemplate {...p} style={{width: 600}}/>} {...options}>
      ...
    </AlertProvider>
  )
}

michaelmika avatar Dec 28 '21 11:12 michaelmika