Example #1
0
        /// <summary>
        /// Adds a new CSS definition with the specified selector to the stylesheet.
        /// </summary>
        /// <param name="selector">The CSS selector for this definition. Use the keyword <c>this</c> (in selector) to scope to the current component.</param>
        /// <param name="value">The raw CSS string.</param>
        public static StylesheetBuilder AddDefinition(this StylesheetBuilder builder, string selector, string?value)
        {
            selector.ThrowIfNull();

            builder.AddString(selector + "{" + value + "}");

            return(builder);
        }
Example #2
0
        /// <summary>
        /// Adds a new CSS definition with the specified selector to the stylesheet.
        /// </summary>
        /// <param name="selector">The CSS selector for this definition. Use the keyword <c>this</c> (in selector) to scope to the current component.</param>
        /// <param name="builderFactory">The factory which is used to create the CSS.</param>
        public static StylesheetBuilder AddDefinition(this StylesheetBuilder builder, string selector, Action <ICssBuilder> builderFactory)
        {
            selector.ThrowIfNull();
            builderFactory.ThrowIfNull();

            var cssBuilder = CssBuilder.Create();

            builderFactory.Invoke(cssBuilder);

            builder.AddString(selector + "{" + cssBuilder.Build() + "}");

            return(builder);
        }