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

Styling: case control flow doesn't add attributes #727

Open
Namek opened this issue Jan 3, 2025 · 0 comments
Open

Styling: case control flow doesn't add attributes #727

Namek opened this issue Jan 3, 2025 · 0 comments
Labels
language Language feature

Comments

@Namek
Copy link
Contributor

Namek commented Jan 3, 2025

Issue: no color is applied in the example below.

https://mint-lang.com/sandbox/kCgrWZIMx8CVeA

Image
type Edge {
  Start
  Middle
  End
}

component Main {
  fun render : Html {
    <div>
      <p::test(Edge.Start)>"Hello Wold!"</p>
      <p::test(Edge.Middle)>"Hello Wold!"</p>
      <p::test(Edge.End)>"Hello Wold!"</p>
    </div>
  }

  style test(edge : Edge) {
    case edge {
      Start => {
        color: red;
      }
      Middle => {
        color: green;
      }
      End => {
        color: brown;
      }
    }
  }
}

The workaround is to use ifs:

  style test2(edge : Edge) {
    if edge == Edge.Start {
      color: red;
    }

    else if edge == Edge.Middle {
      color: green;
    }

    else if edge == Edge.End {
      color: brown;
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language Language feature
Development

No branches or pull requests

2 participants