-
Notifications
You must be signed in to change notification settings - Fork 836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to change container width to 100% #634
Comments
width changed after added I also think that the block should inherit the width and height of the parent. |
Any updates on this? Frankly I’m a little bummed out by how limited the styling options has gotten after the move to Shadow DOM and Custom Elements – the picker was perfectly customizable with React and Styled Components before, and now I can’t even make the inner container adapt its width due to CSS variables having to be predefined in order to style things..? I’m all for upgrading to more modern technologies, but this feels premature? |
This has nothing to do with Shadow DOM / custom elements; it would’ve have been as “limited”. The width currently cannot be dynamic for performance reasons. In the context of a virtualized list (which we do now), handling dynamic width adds a layer of unpredictability that makes this a bit more complicated. It definitely can be done smartly (hint: |
I’m actually unable to scroll the list of emoji. I’m not sure if it’s the layout I’m rendering it in or what, but it’s just not scrolling. I’m also not sure about what you’re referring to, but my styling options are much more limited now than they were before: There are no <nav part="nav">
...
</nav> These could have been targeted and styled by doing: em-emoji-picker ::part(nav) {
background: red;
} I’m thus left with a few very eclectically selected CSS variables with weird logic and rules attached. Some of them are mapped really weirdly 🤔: .search input[type="search"] {
background-color: var(--em-color-border);
} Some of them require the variable follow a specific format: --rgb-color: ${Object.values(parseToRgb(app.theme.someHexColor)).join(', ')}; Some of the Some of the In the previous version, I could simply extract the Where I could just pass Reactified SVG icons before… import {
Clock as Recent,
Smile as People,
Github as Nature,
Coffee as Foods,
Dribbble as Activity,
Map as Places,
Watch as Objects,
CheckSquare as Symbols,
Flag as Flags
} from 'styled-icons/feather'
<Picker icons={{
categories: {
recent: () => <Recent size={20} />,
people: () => <People size={20} />,
nature: () => <Nature size={20} />,
foods: () => <Foods size={20} />,
activity: () => <Activity size={20} />,
places: () => <Places size={20} />,
objects: () => <Objects size={20} />,
symbols: () => <Symbols size={20} />,
flags: () => <Flags size={20} />
}
}} /> …I now have to… import { renderToString } from 'react-dom/server'
const svg = Icon => renderToString(
<Icon
size={20}
// Unless I make sure to specify these as inline styles, Emoji Mart’s CSS will blindly set these attributes for me, ruining the look of my custom icons..?
style={{
width: 20,
height: 20,
fill: 'none',
strokeWidth: 1.5
}} />
)
<Picker categoryIcons={{
frequent: { svg: svg(Frequent) },
people: { svg: svg(People) },
nature: { svg: svg(Nature) },
foods: { svg: svg(Foods) },
activity: { svg: svg(Activity) },
places: { svg: svg(Places) },
objects: { svg: svg(Objects) },
symbols: { svg: svg(Symbols) },
flags: { svg: svg(Flags) }
}} /> Sorry for going |
That wouldn’t be a known issue, we would need reproducible steps.
Sure, sounds like a good idea. PR more than welcome 🙃.
Quite the contrary. By going web component instead of React component, we can include a lot more frontend frameworks. I’m convinced we’ll see more and more web components like this. |
Um~ how to solve the above problem in the typescript? |
My intention is to have emoji container with exactly same width as width of input element and also be responsive across all screen dimensions.However even after looking into #45 , I cannot exactly figure out if it is all i need to do to override existing style. No change in width was seen even after passing
style
as param.I believe that it is because of Inline width on section element (which is 352px as in the first screenshot above) and a subsequent children (a div element which wraps all emojis) of inline width 324px.
My code :
I have also applied few css rules for
em-emoji-picker
tag and that is working perfectly. But no css rule is working for its children.The text was updated successfully, but these errors were encountered: