Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
react-styled-shadow-dom
Advanced tools
React shadow DOM that works well with styled-components.
npm install --save react-styled-shadow-dom
Normally, when you try to use react-shadow, CSS styles from styled-components and theming information won't propagate to the shadow DOM.
The following example shows how easy it is to include styled content inside of shadow DOM using react-styled-shadow-dom
.
import React, { Component } from 'react'
import StyledShadow from 'react-styled-shadow-dom'
import styled, { ThemeProvider } from 'styled-components'
const InnerBox = styled.div`
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
background: red;
`
const Text = styled.h4`
color: #fff;
`
export default () => (
<ThemeProvider theme={{ mode: 'dark' }}>
<StyledShadow
style={{
width: 320,
margin: '0 auto'
}}
>
<InnerBox>
<Text>Hello iframe!</Text>
</InnerBox>
</StyledShadow>
</ThemeProvider>
)
You can view the above demo live here.
This seems simple, but it's actually fairly involved. It requires the use of StyleSheetManager in order to properly propagate all styles from styled-components.
Property | Type | Default | Description |
---|---|---|---|
children | node | Required | Iframe body content. |
style | object | { display: 'block', overflow: 'scroll', border: 0 } | Override iframe styles. Useful for setting width and height of iframe content. |
...rest | object | Any other props will be passed onto react-frame-component . |
MIT © hydrateio
FAQs
React shadow dom that works well with styled-components.
The npm package react-styled-shadow-dom receives a total of 3 weekly downloads. As such, react-styled-shadow-dom popularity was classified as not popular.
We found that react-styled-shadow-dom demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.