Beispiel #1
0
 internal static T AddTooltip <T>(this T component) where T : IFomanticComponentWithTooltip
 {
     if (component.HasTooltip())
     {
         component.AddOrUpdateAttribute("data-tooltip", component.TooltipText);
         if (component.IsTooltipInverted.HasValue && component.IsTooltipInverted.Value)
         {
             component.AddOrUpdateAttribute("data-inverted", "");
         }
         else
         {
             if (component is IFomanticComponentWithInvertedStyle && (component as IFomanticComponentWithInvertedStyle).IsInverted)
             {
                 component.AddOrUpdateAttribute("data-inverted", "");
             }
         }
         component.AddOrUpdateAttribute("data-position", IFomanticComponentWithTooltip.ToClass(component.TooltipPosition));
         string variation = "";
         variation += " " + IFomanticComponentWithSize.ToClass(component.TooltipSize);
         if (component.IsTooltipBasicFormat)
         {
             variation += " basic";
         }
         component.AddOrUpdateAttribute("data-variation", variation);
     }
     else
     {
         component.RemoveAttribute("data-tooltip");
         component.RemoveAttribute("data-variation");
         component.RemoveAttribute("data-position");
     }
     return(component);
 }
 internal static T AddSizeClass <T>(this T component, int?index = null) where T : IFomanticComponentWithSize
 {
     if (index.HasValue)
     {
         component.CssClasses.Insert(index.Value, IFomanticComponentWithSize.ToClass(component.Size));
     }
     else
     {
         component.CssClasses.Add(IFomanticComponentWithSize.ToClass(component.Size));
     }
     return(component);
 }