Skip to content

Commit

Permalink
Streamlit theme functionality
Browse files Browse the repository at this point in the history
 * Adjsuted css for light/dark streamlit themes
 * Adjusted react for theme operations
 * Fixed path identification in index.html
 * Added release change
  • Loading branch information
stavrostheocharis committed Jan 5, 2024
1 parent 16207b7 commit 0f1be22
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="streamlit-token_craft",
version="0.1.5",
version="0.2.0",
author="Stavros Theocharis",
author_email="[email protected]",
description="streamlit custom token craft and management component",
Expand Down
2 changes: 1 addition & 1 deletion token_craft/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import streamlit.components.v1 as components
import os

_RELEASE = False
_RELEASE = True

if not _RELEASE:
_component_func = components.declare_component(
Expand Down
1 change: 1 addition & 0 deletions token_craft/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "streamlit-token-craft",
"version": "0.1.0",
"private": true,
"homepage": "./",
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
Expand Down
12 changes: 6 additions & 6 deletions token_craft/frontend/src/TokenTable.css
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ th[data-tooltip]:hover::after, td[data-tooltip]:hover::after {
pointer-events: none; /* Ignore mouse events */
}

/* TODO: Need to identify the streamlit theme to add colours and hovers */
/*
/* Custom colours based on theme */

.light th {
background-color: #fafafa;
color: #333;
Expand All @@ -127,16 +127,16 @@ th[data-tooltip]:hover::after, td[data-tooltip]:hover::after {


.dark th {
background-color: #444;
background-color: #555;
color: white;
}

.dark tr:nth-child(even) {
background-color: #383838;
background-color: #404040;
}

.dark tr:hover {
background-color: #2c2c2c;
} */
background-color: #333;
}


7 changes: 2 additions & 5 deletions token_craft/frontend/src/TokenTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,10 @@ interface TokenTableProps extends ComponentProps {
}


const TokenTable: React.FC<TokenTableProps> = ({ args }) => {
const TokenTable: React.FC<TokenTableProps> = ({ args, theme }) => {
const { columnVisibility } = args;
const [pendingDeletion, setPendingDeletion] = useState<string | null>(null);
const [tokenList, setTokenList] = useState<Token[]>(args.tokens || []);
const { theme } = args;
const currentTheme = theme?.base || 'light';

useEffect(() => {
// Handle theme change if necessary
}, [args.theme]);
Expand Down Expand Up @@ -128,7 +125,7 @@ const TokenTable: React.FC<TokenTableProps> = ({ args }) => {
};

return (
<div className={`token-table-container ${currentTheme}`}>
<div className={`token-table-container ${theme?.base}`}>
<table className="token-table">
<thead>
<tr>
Expand Down

0 comments on commit 0f1be22

Please sign in to comment.