diff --git a/my code/04-hidden-search-widget/index.html b/my code/04-hidden-search-widget/index.html new file mode 100644 index 0000000..7de23cc --- /dev/null +++ b/my code/04-hidden-search-widget/index.html @@ -0,0 +1,30 @@ + + + + + + + + 04 hidden search widget + + + + + + + + +
+ + + + +
+ + + + \ No newline at end of file diff --git a/my code/04-hidden-search-widget/script.js b/my code/04-hidden-search-widget/script.js new file mode 100644 index 0000000..d8a704a --- /dev/null +++ b/my code/04-hidden-search-widget/script.js @@ -0,0 +1,13 @@ +const input = document.getElementById("text"); +let i = 1; + +function clickHandler() { + if (!(i % 2)) { + input.classList.remove("active"); + } else { + input.classList.add("active"); + input.focus(); + } + + i++; +} diff --git a/my code/04-hidden-search-widget/style.css b/my code/04-hidden-search-widget/style.css new file mode 100644 index 0000000..f6c3851 --- /dev/null +++ b/my code/04-hidden-search-widget/style.css @@ -0,0 +1,39 @@ +* { + margin: 0; + padding: 0; +} +body { + display: flex; + justify-content: center; + align-items: center; + width: 100vw; + height: 100vh; + background-color: violet; +} + +.container { + display: flex; + position: relative; +} + +input, +button { + border: unset; + height: 50px; + font-size: 20px; + outline: none; +} + +input { + width: 0px; + transition: all 0.2s linear 0.1ms; +} + +button { + padding: 0 15px; +} + +.active { + width: 200px; + padding: 0 20px; +}