Skip to content

[horiz-layout] Add collapsible_container#1978

Merged
karriebear merged 9 commits intostreamlit:horiz-layoutfrom
karriebear:layout-expandable
Sep 11, 2020
Merged

[horiz-layout] Add collapsible_container#1978
karriebear merged 9 commits intostreamlit:horiz-layoutfrom
karriebear:layout-expandable

Conversation

@karriebear
Copy link
Copy Markdown
Contributor

@karriebear karriebear commented Sep 8, 2020

Issue: Closes #958

Description:

  • Add collapsible_container(label="", collapsed=False)
  • Create a base _container_block to be shared between container and collapsible_container

Preview
Demo

ezgif com-video-to-gif


Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was on the fence about adding a test for this. Let me know if you think we need.

@karriebear karriebear marked this pull request as ready for review September 8, 2020 17:23
@karriebear karriebear requested a review from a team September 8, 2020 17:23
@andfanilo
Copy link
Copy Markdown
Contributor

Small idea, if one could define a label on st.container too, then you could define functions (or query param) to scroll to container with given label (and then make TOCs at the beginning of a long Streamlit app instead of collapsing all containers at the beginning).
That way you could do anchoring (#1854) through containers instead of markdown. I can just put headings as first line of container, subheadings in nested container...
It's a bit different from classic Jupyter behavior though so it might throw off some users in the beginning.

@karriebear karriebear changed the title Add collapsible_container [horiz-layout] Add collapsible_container Sep 10, 2020
Copy link
Copy Markdown
Contributor

@akrolsmir akrolsmir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, LGTM!

@karriebear karriebear merged commit e1cd71d into streamlit:horiz-layout Sep 11, 2020
akrolsmir added a commit that referenced this pull request Sep 21, 2020
* [Horizontal Layout] Implement st.container() (#1961)

* Fix up dg._block() to be dg.container()

* Add a unit test

* Add an e2e test for st.container

* Minor cleanups

* Clean up variable names and comments

* Clean up deltaPath code and docs

* [Horizontal Layout] Implement `with DG` (#1964)

* Force reinstall of setuptools to 49.6.0 (#1962)

* try updating in virtualenv

* new cache

* am i using 39.0.1 and if so why is it failing?

* somewhere somehow we are upgrading to setuptools 50.0.3... but where..?

* looks like somewhere between setup + pipenv-install we get a newer version of setuptools

* looks like somewhere between setup + pipenv-install we get a newer version of setuptools

* force reinstall

* looks like it's test requirements messing us up?

* force reinstall + cleanup debugs

* Fix up dg._block() to be dg.container()

* Add a unit test

* Add an e2e test for st.container

* Minor cleanups

* Clean up variable names and comments

* Clean up deltaPath code and docs

* Organize DGs in a tree, to track the `with DG`

* Enable `with` in every st.foo call

* Appease mypy with # type: ignore

* More sacrifices at the altar of mypy

* Add unit and e2e tests for with

* Actually, don't rely on each DG mixin to call _active_dg

Revert "Appease mypy with # type: ignore"

This reverts commit 4ba7c47.

Revert "Enable `with` in every st.foo call"

This reverts commit 9b467d6.

* Use the active DG for all "protected" class methods

* Clean up DG docs

* Don't switch DGs from add_rows

Per Karrie's suggestion

Co-authored-by: karrie <[email protected]>

* [horiz-layout] Add collapsible_container (#1978)

* Add collapsible_container

* Add default collapsed

* make label required + initial docs

* Consolidate with WIP column work

* Address PR comments for more cleanliness

* Update e2e tests

* Rename collapsible container (#1993)

* rename to expander

* Fix tests

* Rename collapsible to expandable

* [Horiz Layout] Columns (#1979)

* Implement columns with variable widths

* Add a e2e test for columns

* Add a unit test

* Update Prettier to 1.19 to allow optional chaining

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining

* Fix e2e test

* Downgrade Prettier back to 1.18

* Empty columns now take up space

* Remove duplicate function from merge conflict

* Use flex-gap instead of margin, so column sides don't get padded

* Minor tweaks requested by code review

* Prefix new layout methods with `beta_`

Co-authored-by: karrie <[email protected]>
@karriebear karriebear deleted the layout-expandable branch October 15, 2020 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants