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(module:drawer): add property HeaderStyle to Drawer component #2809

Merged

Conversation

danielbotn
Copy link
Contributor

a property for modifying the style of the header in the drawer component

🤔 This is a ...

  • [ x] New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • [x ] Component style update
  • Bundle size optimization
  • Performance optimization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

This pull request adds a HeaderStyle property to the Drawer component
Blazor Drawer

💡 Background and solution

When changing css for the Drawer header, there is no property available to do so. This PR add that property, for changing for example, the background-color of the header in the Drawer.

The new property in the Drawer component looks like this

<Drawer 
  Visible="@Visible" 
  Placement="@Placement" 
  Title="CompanyName" 
  OnClose="_ => Close()" 
  BodyStyle="@DrawerBackgroundColor" 
  HeaderStyle="@HeaderBackgroundColor"> @* <--added this property * @
...
</Drawer>

This is an example of what the new property does:

ant-design-drawer-header

📝 Changelog

A property is added to the Drawer component

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • [x ] Doc is updated/provided or not needed
  • [x ] Demo is updated/provided or not needed
  • [ x] Changelog is provided or not needed

@github-actions
Copy link

github-actions bot commented Oct 15, 2022

@dnfadmin
Copy link

dnfadmin commented Oct 15, 2022

CLA assistant check
All CLA requirements met.

@ElderJames
Copy link
Member

Thanks for contribute this @danielbotn , but please change the target branch to feature because this is a new feature will be ship in next minor version, maybe 0.13.0.

@danielbotn danielbotn changed the base branch from master to feature October 15, 2022 10:39
@ElderJames ElderJames force-pushed the feat/add-headerstyle-to-drawer branch from ebae152 to 5b412c6 Compare October 17, 2022 05:34
@@ -63,7 +63,8 @@ tasks can be achieved more efficiently within thesame context.
| CloseOnNavigation | Whether to close the drawer when the navigation history changes | `boolean` | `true` |
| Keyboard | Whether to support keyboard esc off | `boolean` | `true` |
| MaskStyle | Style for Drawer's mask element. | `string` | `{}` |
| BodyStyle | Body style for Drawer body element. Such as height, padding etc. | `string` | `{}` |
| BodyStyle | Body style for Drawer body element. Such as height, padding etc. | `string` | `{}` |
| HeaderStyle | Header style for Drawer header element. Such as height, padding etc. | `string` | `{}` |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may also add the parameter for DrawerOptions class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ElderJames
This was added to the DrawerOptions class. Are you referring to ### Drawer? Should the property also be added there,
for example, like this:

## API

### Drawer

| Property      | Description                                                                                    | Type           | Default Value |
| ------------- | ---------------------------------------------------------------------------------------------- | -------------- | ------------- |
| Title         | the title for drawer                                                                           | string or slot | -             |
| BodyStyle     | Style of the drawer content part                                                               | object         | -             |
| HeaderStyle   | Style of the header content part                                                               | object         | -             |
| Closable      | Whether a close (x) button is visible on top right of the Drawer dialog or not.                | boolean        | true          |
| ChildContent  | Subcomponent                                                                                   | object         | -             |
| MaskClosable  | Clicking on the mask (area outside the Drawer) to close the Drawer or not.                     | boolean        | true          |
| MaskStyle     | Style for Drawer's mask element.                                                               | object         | -             |
| Mask          | Whether to show mask or not.                                                                   | boolean        | true          |
| Placement     | The placement of the Drawer, option could be left , top,`right`,`bottom`                   | string         | right       |
| WrapClassName | The class name of the container of the Drawer dialog.                                          | string         | -             |
| Width         | Width of the Drawer dialog, only when placement is 'left' or 'right'.                          |                | int           |
| Height        | placement is top or bottom, height of the Drawer dialog.                                       | int            | 256           |
| ZIndex        | The z-index of the Drawer.                                                                     | int            | -             |
| OffsetX       | The the X coordinate offset(px), only when placement is 'left' or 'right'.                 | int            | 0             |
| OffsetY       | The the Y coordinate offset(px), only when placement is 'top' or 'bottom'.                 | int            | 0             |
| Visible       | Whether the Drawer dialog is visible or not.                                                   | boolean        | -             |
| Keyboard      | Whether support press esc to close                                                             | boolean        | true          |
| OnClose       | Specify a callback that will be called when a user clicks mask, close button or Cancel button. | EventCallback    | -             |
| OnOpen        | Specify a callback that will be called after drawer rendered                                   | Func<Task>    | -             |

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Drawer.razor.cs and DrawerOptions is two party.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently you add this parameter to Drawer.razor.cs but not DrawerOptions 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, ok will do!

@codecov
Copy link

codecov bot commented Oct 17, 2022

Codecov Report

Base: 40.24% // Head: 40.30% // Increases project coverage by +0.06% 🎉

Coverage data is based on head (a9f80c7) compared to base (421b76e).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           feature    #2809      +/-   ##
===========================================
+ Coverage    40.24%   40.30%   +0.06%     
===========================================
  Files          543      543              
  Lines        25807    25809       +2     
  Branches       260      260              
===========================================
+ Hits         10385    10402      +17     
+ Misses       15382    15367      -15     
  Partials        40       40              
Impacted Files Coverage Δ
components/drawer/Drawer.razor 0.00% <ø> (ø)
components/drawer/Drawer.razor.cs 0.00% <0.00%> (ø)
components/drawer/DrawerContainer.razor 0.00% <ø> (ø)
components/drawer/config/DrawerOptions.cs 0.00% <0.00%> (ø)
...nts/core/Component/Overlay/OverlayTrigger.razor.cs 55.49% <0.00%> (+2.61%) ⬆️
components/core/Component/Overlay/Overlay.razor.cs 74.41% <0.00%> (+6.97%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

danielbotn and others added 3 commits October 20, 2022 12:00
a property for modifying the style of the header in the drawer component
Add HeaderStyle to DrawerOptions and update docs
@ElderJames ElderJames force-pushed the feat/add-headerstyle-to-drawer branch from b4d5fb7 to a9f80c7 Compare October 20, 2022 04:05
@ElderJames ElderJames merged commit 99ff161 into ant-design-blazor:feature Oct 20, 2022
zxyao145 pushed a commit to zxyao145/ant-design-blazor that referenced this pull request Oct 23, 2022
…nt-design-blazor#2809)

* feat(module:drawer): add property HeaderStyle to Drawer component

a property for modifying the style of the header in the drawer component

* feat(docs): add property HeaderStyle to Drawer api

Add HeaderStyle to DrawerOptions and update docs

* fix missing HeaderStyle for drawer servcie

Co-authored-by: James Yeung <shunjiey@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants