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

Percent based width #1

Open
gempir opened this issue Mar 11, 2020 · 1 comment
Open

Percent based width #1

gempir opened this issue Mar 11, 2020 · 1 comment

Comments

@gempir
Copy link

gempir commented Mar 11, 2020

I'm trying to implement 2 buttons that are on the same row and will each fill 50% of the row.

Changing the toPx like this, and changing propTypes

    if (typeof (value) === "string" && (value.endsWith("px") || value.endsWith("%"))) {

allows me to also use % as prop, but Outlook doesn't like that at all with the VML buttons. Is there any way to get the VML Buttons to work with percent?

@jacksontrieu
Copy link
Owner

@gempir this might be possible using the mso-width-percent VML property:
https://www.emailonacid.com/blog/article/email-development/emailology_vector_markup_language_and_backgrounds/

You would have to update thecalculateVmlRectStyles function to conditionally output width or mso-width-percent based on the value provided. Something like this:

calculateVmlRectStyles() {
  const stylesHash = {
    'height': toPx(this.props.height),
    'v-text-anchor': 'middle',
  };

  if (widthIsPercentage(this.props.width) { // You would need to implement the widthIsPercentage function
    stylesHash['mso-percent-width'] = this.props.width;
  }
  else {
    stylesHash['width'] = this.props.width;
  }

  return hashToStyles(stylesHash);
  }

Feel free to open a PR if you can get this to work :)

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

2 participants