noahsettersten commited on
Commit
aa2cbe3
1 Parent(s): 90b7c15

docs: `keyword_higlighter` attributes and story

Browse files
lib/medical_transcription_web/components/keyword_highlighter.ex CHANGED
@@ -6,6 +6,9 @@ defmodule MedicalTranscriptionWeb.Components.KeywordHighlighter do
6
  use MedicalTranscriptionWeb, :html
7
  # alias Phoenix.HTML.Tag
8
 
 
 
 
9
  def highlight(assigns) do
10
  # TODO: Eliminate the need to use `raw` here.
11
  ~H"""
 
6
  use MedicalTranscriptionWeb, :html
7
  # alias Phoenix.HTML.Tag
8
 
9
+ attr :text, :string, required: true
10
+ attr :keywords, :list, required: true
11
+
12
  def highlight(assigns) do
13
  # TODO: Eliminate the need to use `raw` here.
14
  ~H"""
storybook/components/keyword_highlighter.story.exs ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ defmodule MedicalTranscriptionWeb.Storybook.KeywordHighlighter do
2
+ use PhoenixStorybook.Story, :component
3
+
4
+ def function, do: &MedicalTranscriptionWeb.Components.KeywordHighlighter.highlight/1
5
+
6
+ def variations do
7
+ [
8
+ %Variation{
9
+ id: :default,
10
+ attributes: %{
11
+ text:
12
+ " This 55-year-old man with known coronary artery disease comes for a follow-up visit today. ",
13
+ keywords: [
14
+ %{
15
+ score: 0.92,
16
+ label: "known coronary artery disease"
17
+ },
18
+ %{score: 0.77, label: "visit today"}
19
+ ]
20
+ }
21
+ }
22
+ ]
23
+ end
24
+ end