Skip to content

Commit d8a12f8

Browse files
committed
improve heading legibility
1 parent 2d8e929 commit d8a12f8

File tree

3 files changed

+36
-23
lines changed

3 files changed

+36
-23
lines changed

Diff for: docs/source/_static/css/larger-headings.css

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
h1,
2+
h2,
3+
h3,
4+
h4,
5+
h5,
6+
h6 {
7+
margin-top: 2em !important;
8+
margin-bottom: 0 !important;
9+
font-weight: 900 !important;
10+
}
11+
12+
h2 {
13+
font-size: 1.8em !important;
14+
}
15+
16+
h3 {
17+
font-size: 1.4em !important;
18+
}

Diff for: docs/source/life-cycle-hooks.rst

+12-17
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ cases the :ref:`Basic Hooks` should be enough, however the remaining
1717
Basic Hooks
1818
===========
1919

20-
Common hooks that should fulfill a majority of use cases.
2120

22-
23-
use_state
21+
Use State
2422
---------
2523

2624
.. code-block::
@@ -45,8 +43,8 @@ of ``new_state``.
4543
.. note::
4644

4745
The identity of ``set_state`` is guaranteed to be preserved across renders. This
48-
means it can safely be omitted from dependency lists in :ref:`use_effect` or
49-
:ref:`use_callback`.
46+
means it can safely be omitted from dependency lists in :ref:`Use Effect` or
47+
:ref:`Use Callback`.
5048

5149

5250
Functional Updates
@@ -92,7 +90,7 @@ result in a re-render:
9290
set_state(state)
9391
9492
95-
use_effect
93+
Use Effect
9694
----------
9795

9896
.. code-block::
@@ -186,18 +184,15 @@ There are **three important subtleties** to note about using asynchronous effect
186184
Supplementary Hooks
187185
===================
188186

189-
Hooks that fulfill some less common, but still important use cases using variations of
190-
the :ref:`Basic Hooks`.
191-
192187

193-
use_reducer
188+
Use Reducer
194189
-----------
195190

196191
.. code-block::
197192
198193
state, dispatch_action = use_reducer(reducer, initial_state)
199194
200-
An alternative and derivative of :ref:`use_state` the ``use_reducer`` hook, instead of
195+
An alternative and derivative of :ref:`Use State` the ``use_reducer`` hook, instead of
201196
directly assigning a new state, allows you to specify an action which will transition
202197
the previous state into the next state. This transition is defined by a reducer function
203198
of the form ``(current_state, action) -> new_state``. The ``use_reducer`` hook then
@@ -218,17 +213,17 @@ We can rework the :ref:`Functional Updates` counter example to use ``use_reducer
218213

219214
The identity of the ``dispatch_action`` function is guaranteed to be preserved
220215
across re-renders throughout the lifetime of the component. This means it can safely
221-
be omitted from dependency lists in :ref:`use_effect` or :ref:`use_callback`.
216+
be omitted from dependency lists in :ref:`Use Effect` or :ref:`Use Callback`.
222217

223218

224-
use_callback
219+
Use Callback
225220
------------
226221

227222
.. code-block::
228223
229224
memoized_callback = use_callback(lambda: do_something(a, b), [a, b])
230225
231-
A derivative of :ref:`use_memo`, the ``use_callback`` hook returns a
226+
A derivative of :ref:`Use Memo`, the ``use_callback`` hook returns a
232227
`memoized <memoization>`_ callback. This is useful when passing callbacks to child
233228
components which check reference equality to prevent unnecessary renders. The of
234229
``memoized_callback`` will only change when the given dependencies do.
@@ -243,7 +238,7 @@ components which check reference equality to prevent unnecessary renders. The of
243238

244239

245240

246-
use_memo
241+
Use Memo
247242
--------
248243

249244
.. code-block::
@@ -277,7 +272,7 @@ after) and should not incur side effects.
277272
to help enforce this.
278273

279274

280-
use_ref
275+
Use Ref
281276
-------
282277

283278
.. code-block::
@@ -290,7 +285,7 @@ The identity of the ``Ref`` object will be preserved for the lifetime of the com
290285

291286
A ``Ref`` is most useful if you need to incur side effects since updating its
292287
``.current`` attribute doesn't trigger a re-render of the component. You'll often use this
293-
hook alongside :ref:`use_effect` or in response to component event handlers.
288+
hook alongside :ref:`Use Effect` or in response to component event handlers.
294289
:ref:`The Game Snake` provides a good use case for ``use_ref``.
295290

296291

Diff for: src/idom/core/hooks.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def use_state(
4949
) -> Tuple[
5050
_StateType, Callable[[Union[_StateType, Callable[[_StateType], _StateType]]], None]
5151
]:
52-
"""See the full :ref:`use_state` docs for details
52+
"""See the full :ref:`Use State` docs for details
5353
5454
Parameters:
5555
initial_value:
@@ -117,7 +117,7 @@ def use_effect(
117117
function: Optional[_EffectApplyFunc] = None,
118118
args: Optional[Sequence[Any]] = None,
119119
) -> Optional[Callable[[_EffectApplyFunc], None]]:
120-
"""See the full :ref:`use_effect` docs for details
120+
"""See the full :ref:`Use Effect` docs for details
121121
122122
Parameters:
123123
function:
@@ -178,7 +178,7 @@ def use_reducer(
178178
reducer: Callable[[_StateType, _ActionType], _StateType],
179179
initial_value: _StateType,
180180
) -> Tuple[_StateType, Callable[[_ActionType], None]]:
181-
"""See the full :ref:`use_reducer` docs for details
181+
"""See the full :ref:`Use Reducer` docs for details
182182
183183
Parameters:
184184
reducer:
@@ -225,7 +225,7 @@ def use_callback(
225225
function: Optional[_CallbackFunc] = None,
226226
args: Optional[Sequence[Any]] = (),
227227
) -> Union[_CallbackFunc, Callable[[_CallbackFunc], _CallbackFunc]]:
228-
"""See the full :ref:`use_callback` docs for details
228+
"""See the full :ref:`Use Callback` docs for details
229229
230230
Parameters:
231231
function: the function whose identity will be preserved
@@ -270,7 +270,7 @@ def use_memo(
270270
function: Optional[Callable[[], _StateType]] = None,
271271
args: Optional[Sequence[Any]] = None,
272272
) -> Union[_StateType, Callable[[Callable[[], _StateType]], _StateType]]:
273-
"""See the full :ref:`use_memo` docs for details
273+
"""See the full :ref:`Use Memo` docs for details
274274
275275
Parameters:
276276
function: The function to be memoized.
@@ -335,7 +335,7 @@ def empty(self) -> bool:
335335

336336

337337
def use_ref(initial_value: _StateType) -> Ref[_StateType]:
338-
"""See the full :ref:`use_state` docs for details
338+
"""See the full :ref:`Use State` docs for details
339339
340340
Parameters:
341341
initial_value: The value initially assigned to the reference.

0 commit comments

Comments
 (0)