Skip to content

Commit

Permalink
fix: updated docs with higher res screenshots and fixed typos/errors …
Browse files Browse the repository at this point in the history
…in code (#382)

* updated docs with higher res screenshots and to fix typos/errors in code

* minor docs updates and saving/reading as python file

* made slight change to handle multine cell definitions in parser

* restored backend and moved saving to python file to new branch

* fix: Restore yarn lock and remove unwanted changes

* fix: space

---------

Co-authored-by: Red Giuliano <red.giuliano@zero-true.com>
Co-authored-by: Carson-Shaar <carson.shaar@zero-true.com>
  • Loading branch information
3 people authored Dec 11, 2024
1 parent 43f829f commit efa5add
Show file tree
Hide file tree
Showing 27 changed files with 51 additions and 6,265 deletions.
35 changes: 25 additions & 10 deletions mintlify-docs/blogs/Buttons in zero-true.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ title: 'Buttons in Zero-True'
Creating a button in zero-true is very easy. It’s as simple as

```py
import zero-true as zt
button=zt.Button(id=’btn’)
import zero_true as zt
button=zt.Button(id='btn')

```

![](/blogs/photos/button.png)
Expand All @@ -18,12 +19,20 @@ button=zt.Button(id=’btn’)
Buttons return True when clicked and False otherwise. There is no need to write callbacks, simply reference buttons as follows.

```py
if button.value==True: print("hello") else: print("goodbye")
if button.value==True:
print("hello")
else:
print("goodbye")
```

## Button Use Cases

Buttons have a ton of potential use cases in zero-true. The example above uses a button to toggle different printed statements but logic can be used to render more complicated layouts. One of the more common patterns for using buttons in zero-true are gating expensive computations, for example:
Buttons have a ton of potential use cases in zero-true.
The example above uses a button to toggle different printed statements but logic can be used to render more complicated layouts.

### Expensive Computations

One of the more common patterns for using buttons in zero-true are gating expensive computations, for example:

```py
import zero_true as zt
Expand All @@ -33,16 +42,21 @@ def expensive_computation():
time.sleep(30)

if button.value==True:
expensive_computation()
expensive_computation()

else:
print("Press Button to Run Expensive Computation")
print("Press Button to Run Expensive Computation")
```

Another use case for buttons in zero-true is getting user confirmation before submitting a form. In the example below we save feedback that a user submits in a text area under a .txt file under their name.
![title](/blogs/gifs/button_computation.gif)

### Creating a Form


Another use case for buttons in zero-true is getting user confirmation before submitting a form.
In the example below we save feedback that a user submits in a text area under a .txt file under their name.


![title](/blogs/gifs/button_computation.gif)

```py
import zero_true as zt
Expand All @@ -60,11 +74,12 @@ text_area = zt.TextArea(id='txt_a',label='Write your feedback here')
button=zt.Button(id='btn', label= 'Submit you feedback')

if button.value==True and name_input.value:
write_feedback(name_input.value, text_area.value)
write_feedback(name_input.value, text_area.value)
```

![](/blogs/photos/button_form.png)

## Customizing your button

You can also add different colors and labels to your button to make things more interesting. Feel free to play around with all the attributes in the documentation.
You can also add different colors and labels to your button to make things more interesting.
Feel free to play around with all the attributes in the documentation.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions mintlify-docs/blogs/Range Sliders in zero-true.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ title: 'Range Sliders in zero-true'
Creating a rage slider in zero-true is simple. Type:

```py
import zero-true as zt
import zero_true as zt
range_slider=zt.RangeSlider(id='slider')
```

![][image1]
![](/blogs/photos/range_slider.png)

Run the cell in your notebook, and watch the range slider appear below.

Expand All @@ -26,7 +26,7 @@ min = range_slider.value[1]
print("Min val is "+str(min)+ " and max val is "+str(max))
```

## ![][image2]
![](/blogs/photos/range_slider2.png)

## Range Slider Use Cases

Expand Down
3 changes: 3 additions & 0 deletions mintlify-docs/blogs/Running a cell on a timer.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: 'Running Cells on a Timer'
---
16 changes: 5 additions & 11 deletions mintlify-docs/blogs/Sliders in zero-true.mdx

Large diffs are not rendered by default.

17 changes: 6 additions & 11 deletions mintlify-docs/blogs/Text Areas in zero-true.mdx

Large diffs are not rendered by default.

14 changes: 4 additions & 10 deletions mintlify-docs/blogs/Text Inputs in zero-true.mdx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mintlify-docs/blogs/UI Components in zero-true.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Some components in zero-true are static, they can be used to display information
* zt.Image
* zt.Text
* zt.Matplotlib
zt.Plotly
* zt.Plotly
* zt.DataFrame
* zt.Layout
* zt.Row
Expand Down
Binary file modified mintlify-docs/blogs/photos/button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mintlify-docs/blogs/photos/button_form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mintlify-docs/blogs/photos/dataframe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mintlify-docs/blogs/photos/matplotlib.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,208 changes: 0 additions & 6,208 deletions mintlify-docs/blogs/photos/merged_csv_2024-11-20_1.csv

This file was deleted.

Binary file modified mintlify-docs/blogs/photos/plotly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mintlify-docs/blogs/photos/range_slider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mintlify-docs/blogs/photos/range_slider_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mintlify-docs/blogs/photos/slider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mintlify-docs/blogs/photos/slider2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mintlify-docs/blogs/photos/text_area.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mintlify-docs/blogs/photos/text_area_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mintlify-docs/blogs/photos/text_area_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mintlify-docs/blogs/photos/text_area_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mintlify-docs/blogs/photos/text_input.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mintlify-docs/blogs/photos/text_input_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mintlify-docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"blogs/Range Sliders in zero-true",
"blogs/Text Inputs in zero-true",
"blogs/Text Areas in zero-true",
"blogs/Displaying a Pandas DataFrame in zero-true",
"blogs/Displaying a Matplotlib Plot in zero-true",
"blogs/Displaying a Plotly Plot in zero-true",
"CLI",
Expand Down

0 comments on commit efa5add

Please sign in to comment.