Skip to content

Commit 524d4dc

Browse files
Enhance table styling in home.py for improved readability and aesthetics
1 parent 39c10ba commit 524d4dc

File tree

1 file changed

+34
-20
lines changed

1 file changed

+34
-20
lines changed

src/pages/home.py

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -273,25 +273,39 @@ def createTable(df, id):
273273
return dash_table.DataTable(
274274
df.to_dict('records'),
275275
columns=[{"name": i, "id": i, "presentation": "markdown"} for i in df.columns],
276-
markdown_options={"html": True},
277-
style_cell={
278-
'padding': '2px',
279-
'font-size': '1.5em',
280-
'textAlign': 'center',
281-
'whiteSpace': 'pre-line',
282-
},
283-
style_header={
284-
'backgroundColor': 'white',
285-
'fontWeight': 'bold'
286-
},
287-
style_data={
288-
'height': 'auto',
289-
'overflowX': 'auto',
290-
},
291-
style_table={
292-
'overflowY': 'auto',
293-
'overflowX': 'auto'
294-
},
276+
markdown_options={"html": True},
277+
style_cell={
278+
'padding': '10px',
279+
'font-size': '1.5em',
280+
'textAlign': 'center',
281+
'whiteSpace': 'normal',
282+
'backgroundColor': '#f9f9f9',
283+
'border': '1px solid #ddd',
284+
'fontFamily': 'sans-serif "Courier New", Courier, monospace !important'
285+
},
286+
style_header={
287+
'fontWeight': 'bold',
288+
'color': 'black',
289+
'border': '1px solid #ddd',
290+
},
291+
style_data={
292+
'height': 'auto',
293+
'lineHeight': '20px',
294+
'border': '1px solid #ddd',
295+
},
296+
style_table={
297+
'overflowY': 'auto',
298+
'overflowX': 'auto',
299+
'border': '1px solid #ddd',
300+
'borderRadius': '5px',
301+
'boxShadow': '0 2px 5px rgba(0,0,0,0.1)',
302+
},
303+
style_data_conditional=[
304+
{
305+
'if': {'row_index': 'odd'},
306+
'backgroundColor': '#f2f2f2',
307+
}
308+
],
295309
id=id)
296310

297311

@@ -587,7 +601,7 @@ def toggle_modal(n1, n2, is_open):
587601
dbc.Col(children=[
588602
html.H3('Category & Alarm types', className='status-title'),
589603
html.Div(statusExplainedTable, className='how-status-table')
590-
], lg=12, md=12, sm=12, className='page-cont pr-1 how-status-cont'),
604+
], lg=12, md=12, sm=12, className='page-cont pr-1 how-status-cont mb-1'),
591605
dbc.Col(children=[
592606
html.H3('Status color rules', className='status-title'),
593607
html.Div(catTable, className='how-status-table')

0 commit comments

Comments
 (0)