Gaikan icon indicating copy to clipboard operation
Gaikan copied to clipboard

Add support for traits

Open pjechris opened this issue 7 years ago • 3 comments

Would be nice to be able to adapt style based on current trait. Just like @media in CSS.

pjechris avatar Jan 03 '17 15:01 pjechris

Do you have an example of declaration you would like to have?

ghost avatar Jan 03 '17 15:01 ghost

Not really sure how we should do it, maybe by combining it with states?

let blueBtn = Style() {
	$0.extends(otherStyle)

	$0.when(state: .hover) {
		$0.extends()
	}

	let trait = TraitCollection()
	$0.when(trait: trait) {
	}

	$0.when(state: .hover, trait: trait) {
	}
}

This would have impact on states. IMO this is not a big deal as current syntax is not great. Any comment is appreciated ;)

pjechris avatar Jan 03 '17 16:01 pjechris

We could in fact handle traits this way and refactor states afterwards.

pjechris avatar Jan 05 '17 09:01 pjechris