File size: 1,444 Bytes
90b7c15 dde655f 90b7c15 dde655f 90b7c15 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
defmodule MedicalTranscriptionWeb.Storybook.ResultList do
use PhoenixStorybook.Story, :component
def function, do: &MedicalTranscriptionWeb.Components.result_list/1
@sample_rows [
{
0.0,
0.7,
" This 55-year-old man with known coronary artery disease comes for a follow-up visit today. "
},
{
0.8,
1.3,
"Last month he was admitted to our hospital with unstable angina. "
},
{
1.4,
2.0,
" He underwent heart catheterization on November 15th, 2007. "
},
{
2.1,
2.8,
"At that time he was found to have a tight 99% proxmost enosis, total occlusion and collateralization "
}
]
def variations do
[
%Variation{
id: :default,
attributes: %{
rows: %Phoenix.LiveView.LiveStream{
inserts: stream_inserts_for_sample_rows()
}
}
}
]
end
defp stream_inserts_for_sample_rows do
@sample_rows
|> Enum.with_index()
|> Enum.map(fn {{start_mark, end_mark, text}, index} ->
# `inserts` in %Phoenix.LiveView.LiveStream requires the following format: {index, at, item, limit}
# We don't need `at` or `limit` here. This helper aids in building up this data for us.
{
index,
nil,
%{
start_mark: start_mark,
end_mark: end_mark,
text: text
},
nil
}
end)
end
end
|