You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: support additional properties to utility method (#120)
This PR enhances the utility method to support additional properties.
For instance, the `lineClamp`
[property](https://github.com/homebound-team/truss/blob/main/packages/truss/src/sections/tachyons/lineClamp.ts)
does have additional properties but those can't be passed to the
`lineClamp(value)` utility method.
Before
```ts
/** Sets `WebkitLineClamp: value`. */
lineClamp(value: Properties["WebkitLineClamp"]) {
return this.add("WebkitLineClamp", value);
}
```
After
```ts
/** Sets `WebkitLineClamp: value`. */
lineClamp(value: Properties["WebkitLineClamp"]) {
return this.add("WebkitLineClamp", value) // default def
.add("overflow", "hidden").add("display", "-webkit-box").add("WebkitBoxOrient","vertical",).add("textOverflow", "ellipsis"); // additional defs
}
```
With these changes, `lineClamp(value)` will have the ability to define
additional properties combining to the `value` param.
Also, added a few tests for `packages/truss/src/methods.test.ts`
cc @bdow since he's going to use it.
0 commit comments