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

feat(core): add value multiplication suffix feature #1383

Merged
merged 1 commit into from
Jan 3, 2022

Conversation

CaerusKaru
Copy link
Member

@CaerusKaru CaerusKaru commented Jan 3, 2022

It may be desirable for users to multiply the base values to keep
some sort of internal consistency. For instance, in Material
Design, values are typically multiplied by 4x or 8x. To support
this, we add a new configuration option to the library that plugs
in to select directives (at this point, only fxFlexOffset and
fxLayoutGap). To use this feature, use the following syntax:

@NgModule({
  imports: [
    FlexLayoutModule.withConfig({
      multiplier: {
        value: 4,
        unit: 'px',
      }
    }),
  ],
})
export class MyAppModule {}
<div fxFlexOffset="3x">My content</div>

This yields:

<div style="margin-right: 12px">My content</div>

This feature is disabled by default, so to use it, you must
explicitly specify both the value and unit of your multiplication.

Fixes #907

It may be desirable for users to multiply the base values to keep
some sort of internal consistency. For instance, in Material
Design, values are typically multiplied by 4x or 8x. To support
this, we add a new configuration option to the library that plugs
in to select directives (at this point, only `fxFlexOffset` and
`fxLayoutGap`). To use this feature, use the following syntax:

```ts
@NgModule({
  imports: [
    FlexLayoutModule.withConfig({
      multiplier: {
        value: 4,
        unit: 'px',
      }
    }),
  ],
})
export class MyAppModule {}
```

```html
<div fxFlexOffset="3x">My content</div>
```

This yields:

```html
<div style="margin-right: 12px">My content</div>
```

This feature is disabled by default, so to use it, you must
explicitly specify both the value and unit of your multiplication.
@CaerusKaru CaerusKaru added this to the 13.0.0-beta.37 milestone Jan 3, 2022
@CaerusKaru CaerusKaru merged commit 4d36b74 into master Jan 3, 2022
@CaerusKaru CaerusKaru deleted the adam/fix-issue-907 branch January 3, 2022 04:17
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Multiplier value for FxLayoutGap
1 participant