-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
chore: add lineSize prop to Burger #432
Merged
AnnMarieW
merged 8 commits into
snehilvj:master
from
ChinoUkaegbu:chore/add-lineSize-to-burger
Dec 5, 2024
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3e67da5
add lineSize prop to Burger
ChinoUkaegbu 5c3f1f2
match the Mantine prop type
ChinoUkaegbu a42e3de
update DatePicker to DatePickerInput in README
ChinoUkaegbu 41350b5
add entry in changelog
ChinoUkaegbu 9b6c5da
edit PR number
ChinoUkaegbu 72f5413
improve docstrings for Burger
ChinoUkaegbu 29698b0
Create test_burger.py
ChinoUkaegbu 89a1625
let lineSize accept numbers only in Burger.tsx
ChinoUkaegbu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -17,6 +17,8 @@ interface Props | |||||
size?: MantineSize | (string & {}) | number; | ||||||
/** Key of `theme.colors` of any valid CSS value, by default `theme.white` in dark color scheme and `theme.black` in light */ | ||||||
color?: MantineColor; | ||||||
/** Height of the burger lines */ | ||||||
lineSize?: string | number; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
/** State of the burger, when `true` burger is transformed into X, `false` by default */ | ||||||
opened?: boolean; | ||||||
/** `transition-duration` property value in ms, `300` by default */ | ||||||
|
@@ -25,7 +27,7 @@ interface Props | |||||
transitionTimingFunction?: string; | ||||||
} | ||||||
|
||||||
/** Burger */ | ||||||
/** The Burger component renders a customizable hamburger menu button which can toggle between open and closed states. */ | ||||||
const Burger = (props: Props) => { | ||||||
const { | ||||||
setProps, | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from dash import Dash, html, Output, Input, _dash_renderer, callback | ||
import dash_mantine_components as dmc | ||
|
||
_dash_renderer._set_react_version("18.2.0") | ||
|
||
|
||
def test_001bu_burger(dash_duo): | ||
app = Dash(__name__) | ||
|
||
app.layout = dmc.MantineProvider( | ||
html.Div( | ||
[dmc.Burger(id="burger-button", opened=False, lineSize=2, ), dmc.Text(id="burger-state", mt="md")] | ||
) | ||
) | ||
|
||
@callback(Output("burger-state", "children"), Input("burger-button", "opened")) | ||
def is_open(opened): | ||
return str(opened) | ||
|
||
dash_duo.start_server(app) | ||
|
||
# Wait for the app to load | ||
dash_duo.wait_for_text_to_equal("#burger-state", "False") | ||
|
||
# Open Burger | ||
burger = dash_duo.find_element("#burger-button") | ||
burger.click() | ||
|
||
# Verify the Burger opens when clicking the button | ||
dash_duo.wait_for_text_to_equal("#burger-state", "True") | ||
|
||
# Close Popover | ||
burger.click() | ||
|
||
# Verify the Burger closes when clicked again | ||
dash_duo.wait_for_text_to_equal("#burger-state", "False") | ||
|
||
assert dash_duo.get_logs() == [] | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @AnnMarieW commented:
If named sizes like
xl
are in fact valid, let's put one in the test. If not, let's removestring |
here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't work with the named sizes. I tried it in a code sandbox with the Mantine react component too, and it can either be
lineSize={5}
orlineSize="5"
but nothing renders if you dolineSize="sm"
@ChinoUkaegbu would you like to update to the prop so it's just
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing!