Skip to content

Commit 44d39cb

Browse files
use add_style instead of _get_style for drawer components (#5734)
* use add_style instead of _get_style for drawer components * fix typo Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
1 parent 286a84e commit 44d39cb

File tree

2 files changed

+10
-22
lines changed

2 files changed

+10
-22
lines changed

pyi_hashes.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"reflex/components/radix/primitives/__init__.pyi": "68fcf93acb9a40d94561d375a3a5fdb1",
4848
"reflex/components/radix/primitives/accordion.pyi": "9192299dac04a5172edd7b2f6b125f53",
4949
"reflex/components/radix/primitives/base.pyi": "336f5e26669a809454bb343e698ab563",
50-
"reflex/components/radix/primitives/drawer.pyi": "5c04c3598100aa4d562c242fabf7e404",
50+
"reflex/components/radix/primitives/drawer.pyi": "c6ad2f60217fe25952f3a1ba88fbd72a",
5151
"reflex/components/radix/primitives/form.pyi": "8a5ec180a50acdc35dfe53e4e65c20e0",
5252
"reflex/components/radix/primitives/progress.pyi": "b26c99c1d827c0f599fff344746aeec3",
5353
"reflex/components/radix/primitives/slider.pyi": "c03b716ffbbc3e1a0c766951de04e83b",

reflex/components/radix/primitives/drawer.py

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ class DrawerContent(DrawerComponent):
124124
alias = "Vaul" + tag
125125

126126
# Style set partially based on the source code at https://ui.shadcn.com/docs/components/drawer
127-
def _get_style(self) -> dict:
127+
def add_style(self) -> dict:
128128
"""Get the style for the component.
129129
130130
Returns:
131131
The dictionary of the component style as value and the style notation as key.
132132
"""
133-
base_style = {
133+
return {
134134
"left": "0",
135135
"right": "0",
136136
"bottom": "0",
@@ -139,9 +139,6 @@ def _get_style(self) -> dict:
139139
"z_index": 50,
140140
"display": "flex",
141141
}
142-
style = self.style or {}
143-
base_style.update(style)
144-
return {"css": base_style}
145142

146143
# Fired when the drawer content is opened.
147144
on_open_auto_focus: EventHandler[no_args_event_spec]
@@ -186,13 +183,13 @@ class DrawerOverlay(DrawerComponent):
186183
alias = "Vaul" + tag
187184

188185
# Style set based on the source code at https://ui.shadcn.com/docs/components/drawer
189-
def _get_style(self) -> dict:
186+
def add_style(self) -> dict:
190187
"""Get the style for the component.
191188
192189
Returns:
193190
The dictionary of the component style as value and the style notation as key.
194191
"""
195-
base_style = {
192+
return {
196193
"position": "fixed",
197194
"left": "0",
198195
"right": "0",
@@ -201,9 +198,6 @@ def _get_style(self) -> dict:
201198
"z_index": 50,
202199
"background": "rgba(0, 0, 0, 0.5)",
203200
}
204-
style = self.style or {}
205-
base_style.update(style)
206-
return {"css": base_style}
207201

208202

209203
class DrawerClose(DrawerTrigger):
@@ -222,21 +216,18 @@ class DrawerTitle(DrawerComponent):
222216
alias = "Vaul" + tag
223217

224218
# Style set based on the source code at https://ui.shadcn.com/docs/components/drawer
225-
def _get_style(self) -> dict:
219+
def add_style(self) -> dict:
226220
"""Get the style for the component.
227221
228222
Returns:
229223
The dictionary of the component style as value and the style notation as key.
230224
"""
231-
base_style = {
225+
return {
232226
"font-size": "1.125rem",
233227
"font-weight": "600",
234-
"line-weight": "1",
228+
"line-height": "1",
235229
"letter-spacing": "-0.05em",
236230
}
237-
style = self.style or {}
238-
base_style.update(style)
239-
return {"css": base_style}
240231

241232

242233
class DrawerDescription(DrawerComponent):
@@ -247,18 +238,15 @@ class DrawerDescription(DrawerComponent):
247238
alias = "Vaul" + tag
248239

249240
# Style set based on the source code at https://ui.shadcn.com/docs/components/drawer
250-
def _get_style(self) -> dict:
241+
def add_style(self) -> dict:
251242
"""Get the style for the component.
252243
253244
Returns:
254245
The dictionary of the component style as value and the style notation as key.
255246
"""
256-
base_style = {
247+
return {
257248
"font-size": "0.875rem",
258249
}
259-
style = self.style or {}
260-
base_style.update(style)
261-
return {"css": base_style}
262250

263251

264252
class DrawerHandle(DrawerComponent):

0 commit comments

Comments
 (0)