Skip to content

Commit

Permalink
GH-485: update dictionary app
Browse files Browse the repository at this point in the history
  • Loading branch information
anh.vu2 committed Sep 12, 2021
1 parent 113f607 commit cdd69c9
Show file tree
Hide file tree
Showing 21 changed files with 24,246 additions and 0 deletions.
21 changes: 21 additions & 0 deletions apps/col_add_entry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import streamlit as st

st.set_page_config(
page_title="Add Entry Dictionary",
layout="wide",
)

word = "A"
st.write('# Dictionary')

col1, col2, col3 = st.columns([10, 1, 40])
col1.text_input('Word')


col3.write("#### Sense")
col3.button('edit')

col3.json({
'foo': 'bar',
'examples': ['ab', 'b', 'c']
})
2 changes: 2 additions & 0 deletions apps/components/json_viewer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
dist
19 changes: 19 additions & 0 deletions apps/components/json_viewer/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2018 The Python Packaging Authority

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions apps/components/json_viewer/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include slider/frontend/build *
Empty file.
30 changes: 30 additions & 0 deletions apps/components/json_viewer/component/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import os

import streamlit.components.v1 as components
import streamlit as st

_RELEASE = False

if _RELEASE:
root_dir = os.path.dirname(os.path.abspath(__file__))
build_dir = os.path.join(root_dir, "frontend/build")
_json_viewer = components.declare_component(
"json_viewer",
path=build_dir
)
else:
_json_viewer = components.declare_component(
"json_viewer",
url="http://localhost:3001"
)


def json_viewer(json_object, key=None):
return _json_viewer(json_object=json_object, key=key, default=0)


json_object = [
{"a": [1, 2, 3]},
"two", "the", "sunny", "day", "beautiful", "mark"]
return_value = json_viewer(json_object=json_object)
st.write(return_value)
6 changes: 6 additions & 0 deletions apps/components/json_viewer/component/frontend/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Run the component's dev server on :3001
# (The Streamlit dev server already runs on :3000)
PORT=3001

# Don't automatically open the web browser on `npm run start`.
BROWSER=none
1 change: 1 addition & 0 deletions apps/components/json_viewer/component/frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
5 changes: 5 additions & 0 deletions apps/components/json_viewer/component/frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"endOfLine": "lf",
"semi": false,
"trailingComma": "es5"
}
Loading

0 comments on commit cdd69c9

Please sign in to comment.