Skip to content
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

how to make responsive twitter embed to mobile device? its available on options ? #85

Open
isggwp opened this issue Aug 10, 2019 · 4 comments

Comments

@isggwp
Copy link

isggwp commented Aug 10, 2019

No description provided.

@fsgreco
Copy link

fsgreco commented Sep 21, 2019

you can try gatsby-remark-responsive-iframe, it worked for me very well, although it generates some problems with my old posts (they have plenty of html code inside md files so there was some conflicts I didn't have the time to check).

an alternative - that's the one I'm using right now - is to insert a global css media query:

@media (max-width: 550px) {
	.twitter-tweet {max-width: 300px !important;}
	iframe { width: 300px; }
}

It is not elegant but it works well...

@raae
Copy link
Member

raae commented Dec 30, 2019

Did this help @qipoy?

@johnnybenson
Copy link

johnnybenson commented Apr 12, 2020

Just sketching an idea, it would awesome if the plugin took a container component in config options that wrapped embeds like Layout wraps pages like this:

<!-- page.md -->

`video: https://www.youtube.com/watch?v=k5veb0wZas0`
// gatsby-config.js

  plugins: [
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          {
            resolve: `@raae/gatsby-remark-oembed`,
            options: {
              container: require.resolve(
                `${__dirname}/src/components/OEmbedContainer/index.js`
              ),
              // usePrefix defaults to false
              // usePrefix: true is the same as ["oembed"]
              usePrefix: ['oembed', 'video'],
...
// components/OEmbedContainer/index.js

// Ideal
const OEmbedContainer = ({ OEmbed }) => ( <div><OEmbed/></div> );

// Because markdown is text
const OEmbedContainer = ({ embed }) => ( <div  dangerouslySetInnerHTML={{ __html: embed }} /> );

Then we can roll our own responsive containers or whatever else.

@raae
Copy link
Member

raae commented Apr 13, 2020

I like!

This fall I have time to give oembed some much-needed TLC and will look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants